26 Apr
2008
26 Apr
'08
12:09 a.m.
Vincent Massol wrote:
Hi,
Yes you can use the velocity Math tool: http://velocity.apache.org/tools/devel/generic/MathTool.html
It's configured by default in XE 1.4M2 (being released right now) so you'll only have to do:
$mathtool.toInteger("10")
Or the older $xwiki.parseInt("42") or the newer $util.parseInt("007"). Looking at com.xpn.xwiki.api.Util, there's also parseDouble, parseFloat, parseLong and parseInteger (returns an Integer object, not a primitive).
-Vincent
On Apr 25, 2008, at 7:20 PM, Ngo Thi Hong Nga wrote:
Hi, is it possible to convert a String to Integer in Velocity? I tried with Groovy but I don't know how to do with Velocity.
-- Sergiu Dumitriu http://purl.org/net/sergiu/