You could use a custom function in VB (‘cause
IsNumeric is more tricky in C#!). Try something like: <script
language="VB" prefix="numeric-tasks" >
<code>
<![CDATA[
[Function("is-integer")]
Public Shared Function IsInteger(ByVal test As Object)
Return
(IsNumeric(test) AndAlso CInt(test) = Val(test))
End Function
]]>
</code> </script> Which you can then call by using <task
if=”${numeric-tasks::is-numeric(myproperty)}”> </task> Where “myproperty” is the name
of the property you wish to evaluate. Note this is types freehand, so may have
typos in it. HTH, Bill From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nau, Michael 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"/> <ifnot
test="${property::exists('is.input.an.integer')}"> Thanks, |
Title: Testing if a value is an Int
- [NAnt-users] Testing if a value is an Int Nau, Michael
- Re: [NAnt-users] Testing if a value is an Int Thibaut Barrère
- [NAnt-users] Testing if a value is an Int Nau, Michael
- RE: [NAnt-users] Testing if a value is an Int Bill Martin