Title: Testing if a value is an Int

Is there a "clean" way to test if a property value is an integer? I've come up with a bit of a hack to accomplish this, but this raises an error in my build log (which shows up in my ccnet errors page…).

Here's my hack:

<property name="is.input.an.integer" value="${int::parse(input)}" failonerror="false"/>   
   
<if test="${property::exists('is.input.an.integer')}">
  <echo message="input is an integer"/> 
</if>

<ifnot test="${property::exists('is.input.an.integer')}">
  <echo message="input is not an integer"/> 
</ifnot>

Thanks,
-Mike

Reply via email to