私は Velocity テンプレートにまったく慣れていないので、「12 34 56 78」または「123 45 678」のように表示される 8 桁の電話番号を取得しようとしています。
私は多くのバリエーションを試しました。
- $number.format('00 00 00 00',${phone})
- $number.format('#0 00 00 00',$phone)
- $display.printf("%s %s %s %s", $phone.substring(0,2), $phone.substring(2,4), $phone.substring(4,6), $phone.substring (6,8))
$number = new NumberTool() および $display = new DisplayTool()
最初の 2 つはスペースなしで数値を出力しますが、最後の 1 つは Velocity によって解析されません。