Struts2的支持本地化(localization)
下面是Java的Format
value | pattern | output | Explanation |
---|---|---|---|
123456.789 | ###,###.### | 123,456.789 | The pound sign (#) denotes a digit, the comma is a placeholder for the grouping separator, and the period is a placeholder for the decimal separator. |
123456.789 | ###.## | 123456.79 | The value has three digits to the right of the decimal point, but the pattern has only two. The format method handles this by rounding up. |
123.78 | 000000.000 | 000123.780 | The pattern specifies leading and trailing zeros, because the 0 character is used instead of the pound sign (#). |
12345.67 | $###,###.### | $12,345.67 | The first character in the pattern is the dollar sign ($). Note that it immediately precedes the leftmost digit in the formatted output . |
12345.67 | \u00A5###,###.### | ¥12,345.67 | The pattern specifies the currency sign for Japanese yen (¥) with the Unicode value 00A5. |
Symbol | Description |
---|---|
0 | a digit |
# | a digit, zero shows as absent |
. | placeholder for decimal separator |
, | placeholder for grouping separator |
E | separates mantissa and exponent for exponential formats |
; | separates formats |
- | default negative prefix |
% | multiply by 100 and show as percentage |
? | multiply by 1000 and show as per mille |
¤ | currency sign; replaced by currency symbol; if doubled, replaced by international currency symbol; if present in a pattern, the monetary decimal separator is used instead of the decimal separator |
X | any other characters can be used in the prefix or suffix |
' | used to quote special characters in a prefix or suffix |
下列代碼就是定義兩位數字(不足者補零)
#number
global.format.index={0,number,00}