Parsing of numeric values

wkbutler <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hello - 
I am a bit confused on the built-in capability of FM to parse a localized
numeric expression, and before I write a custom routine for this, maybe
there is wisdom I lack.

I am trying to process a mathematical expression on the contents of a map of
string data:

---------------
| a |  1,111    |
| b |  2,222    |
---------------

so a simple expression like
     ${a?number + b?number}  

would work if the numbers were not localized, right?  That I have had
success with.

The original syntax 
   #{a} + #{b}

is deprecated according to this page in the docs
    
http://freemarker.sourceforge.net/docs/ref_depr_numerical_interpolation.html 

although trying this I get the error message:

    a is not a number, it is freemarker.template.SimpleScalar

Using the number built-in  ?c  and the string built-in ?string.computer 
fail with similar messages, such as "Expected hash" etc.   It seems I do not
understand what data type I am dealing with.   

I would like to have have the 2 numbers added together and output with the
default localized syntax.  Am I looking past something?    Thanks for ideas
-
-- 
View this message in context: http://www.nabble.com/Parsing-of-numeric-values-tp25446898p25446898.html
Sent from the freemarker-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
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.