Re: numeric value replacement

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Thursday, June 5, 2008, 7:12:08 AM, Samy123 wrote:

> Hi-
> Is there any way to replace value of a number with the desired value..
> for ex. I am having a following line in the template 
> The condition is ${120}.
>
> And the value of 120 is  stored in the string as "for number a specific
> number".  
> Now how can I replace the value of 120 with the string?
> As of now while running the freemarker,it is printing the number 120 as it
> is and not replacing with the string.

You may need to rephrase this whole question because certainly nobody
will understand it. I don't understand it at least. As ${aNumber} will
be replaced in the output with a character sequence, the value of
aNumber will be converted to string without asking. If you want to
convert a number to a string inside a more complex expression, like in
${iNeedAString(aNumber)}, then you should write aNumber?c or
aNumber?string, depending on whether you want "computer audience" or
"human audience" formatting. See:
http://freemarker.org/docs/ref_builtins_number.html

> (tested on 2.1.12 of freemarker).
>
> Thanks,
> ~Samir


-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
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.