Test if a string variable with "-" is numerical


I have a string. Sometimes it can be empty, “-”, positive number, or negative number. If it is negative is has a “-” in front.

I need to test if it is numeric
Str= -
Str= 1000
Str= -1000

But this


doesn’t work when it is a negative number. Thank you


For Negative Number, check as below


The above will throws the error

So as below, you can surround with TryCatch

As above you can get only integers, No spaces or strings

Hope this helps


Hello @Anonymous2,

Check this ,


Hi All

Thanks for the replies. The problem is that Uipath can’t interpret the negative value as numeric. I need to find out in an IF condition is the Str is numeric (positive/negative), or dash/empty.

So is there an easy way to remove the “-” if Str is a negative value but retain the “-” if Str is only a dash.
Perhaps use Regex Replace in the If condition?

Thank you

@Anonymous2 You can use Math.Abs(CDbl(“yourValue”)) for this purpose.

If it is only a Dash then it is not number, So IsNumeric will return a False