Re: Removing comma's on outputted integers
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Tuesday, January 12, 2010, 11:26:46 AM, Jordan Mendler wrote:
> Hi all,
>
> I am new to Freemarker, and can't figure out how to display
> integers without comma groupings. For instance, I want to display
> 25000 but instead freemarker displays 25,000.
>
> I am seeing lots of things online, such as setting number_format,
> using the c function, locales, and other options, but none of them
> seem to work.
They definitely should work. Especially ?c. If they don't, you mix up
something somewhere... looking at the wrong template or something. Or,
what you are outputting is maybe not a number, but already a string?
Try what ${yourVariable?is_number?string} and
${yourVariable?is_string?string} says.
> I think I somehow need set setGroupingUsed(false) in the
> NumberFormat within the Freemarker Configuration object, but can't
> quite figure out how. setNumberFormat() takes a String so seems to
> be difference.
You shouldn't need setGroupingUsed... the example in the FAQ should
work. But see earlier.
> Can someone please point me in the right direction here?
>
> I am using Freemarker standalone for XML processing, in a fairly
> plain way, with construction like this:
> Configuration fmConfig = new Configuration();
> fmConfig.setDirectoryForTemplateLoading(new File( directory ));
> fmConfig.setObjectWrapper(new DefaultObjectWrapper());
(No problem with these...)
>
> Thanks so much,
> Jordan
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev