Java – FreeMarker, can I set the computer number format by default?

About FreeMarker, can you tell it to treat all numbers as "computers" by default?

I tried to apply

cfg.setSetting(Configurable.NUMBER_FORMAT_KEY,"computer");

or

cfg.setNumberFormat("computer");

Configuration object, but the result is not ideal I believe this is the method of documentation. Is there anything wrong?

Solution

The number format you specify must be Java text. Decimalformat supported formats The closest thing you can do now is to switch the locale to en_ Us (and better ensure that it does not use groping; see http://freemarker.org/docs/app_faq.html#faq_number_grouping )Or, of course, you can write it all? C-S, but I think that's what you want to avoid

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>