You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ryan19 <se...@gmail.com> on 2008/11/19 14:36:56 UTC

String to int.

Hi,

  Does anyone know can you convert a String to int in velocity code?

Any help is appreciated,

Thanks,

John
-- 
View this message in context: http://www.nabble.com/String-to-int.-tp20579899p20579899.html
Sent from the Velocity - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: String to int.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
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


Re: String to int.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
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