velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: String to int.
Date Wed, 19 Nov 2008 14:13:58 GMT
Ryan,

This is more of a "user" question than a dev question, but I'll answer
it, anyway (and cross-post to the user list).

ryan19 wrote:
> Does anyone know can you convert a String to int in velocity code?

Velocity does not support this directly, but Velocity-Tools does (it's a
small but super-useful library that you can download from the Velocity
site). In Velocity-Tools, there's a "tool" called NumberTool which has
an "integer" method that converts from many things to Integer.

You can also use MathTool.toInteger if you'd like.

-chris


Mime
View raw message