Re: Number format error in free marker

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Saturday, December 12, 2009, 1:19:58 AM, Kunal wrote:

> Hi,
>
> I am doing some computation in freemarker. I am getting the the value from
> the requestParameters. for eg. 
>
> [#if RequestParameters.offset??]
>     [#assign offset = RequestParameters.offset?number]
> [#else]
>     [#assign offset = 0]
> [/#if]
>
> this offset can grow up to a large value. However, FM adds a separator if it
> goes beyond 999. 
> So 1000 becomes 1,000.

That could happen in the above code. There you convert string to
number, not the other way around. The problem is in the template where
you generated the form or the URL that contains the query parameter.

> I tried using ?c but that did not work either.

Certainly you used it on the wrong place... see above.

> Is there any number format setting that I can do so that I can tell FM no to
> add any separator?

Yes (see:
http://freemarker.org/docs/app_faq.html#faq_number_grouping), but the
(theoretically) correct solution is to use ?c when you print for
computer-audience.

> Thanks
>

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.