开发者

Integer gets formatted with commas when it gets fetched from a ResourceBundle

year.of.birth={0} was born on {1}

If I pass 2000 or 2008 to {1} the value gets 开发者_如何转开发parsed as 2,000 or 2,008. 

I don't want the commas as part of my translated string. How should I avoid this?


The easy way is to pass them as Strings:

msg.format("year.of.birth", name,  String.valueOf(2008));

An alternative is to specify the number format in the message resource (but I would only do that if the format can vary between locales):

year.of.birth={0} was born in {1,number,####}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜