How to check if string contain Integar



Please help. How to use IsDigit in Uipath; to check if string contain integar.

For example:

string j = “j2345”;
Boolean isIntString = k.All(char.IsDigit);



string j = "j2345"; string y = "7865"; Boolean isIntStringj = j.All(Function(x) char.IsDigit(x)); // false Boolean isIntStringy = y.All(Function(x) char.IsDigit(x)); // true

Note that you need to pass a delegate (so a function) that takes a char and returns a bool. Also IsDigit needs an input argument to work.


Great, that works perfect.


Microsoft.VisualBasic.Information.IsNumeric(yourStringVariable) also returns Boolean
This is much simpler I suppose :slight_smile:


IsNumeric returns True if the data type of Expression is Boolean, Byte, Decimal, Double, Integer, Long, SByte, Short, Single, UInteger, ULong, or UShort, or an Object that contains one of those numeric types. It also returns True if Expression is a Char or String that can be successfully converted to a number

So using IsNumeric might give unexpected results.