velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: String Numerical Testing?
Date Mon, 08 Nov 2004 20:50:55 GMT
Hi Clifton,

> Hello all. I'm still green with Velocity. I'm wondering what's the
> easiest way to test a string for a numeric. For example, I have a string
> $myVal that can contain "foo", or "23.2", or "15". I want to 1st check
> if it is a numeric and then wrap it with quotes if it is not.
I would use o.a.c.l.math.NumberUtils as a tool.
   http://jakarta.apache.org/commons/lang/apidocs/org/apache/commons/lang/math/NumberUtils.html#isNumber(java.lang.String)

If it doesn't do what you want, you can always create your own tool.  ;)

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai <shinobu.kawai@gmail.com>

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


Mime
View raw message