Substring in Visual Basic/UiPath


I am trying to read a value and if the first three digits of the value are “000” then it should cause an error.

Currently I have "item.Value.ToString.Substring(0,2) = “000"” but this does not catch the that the first three digits are zeros. However this is also combined in an or statement to check if the first three digits are “666”.

What is the correct syntax to accomplish this? Thanks.



If you wanna check 3 digits …you should put 3 not 2.


If you need to compare first three digit then replace (0,2) to (0,3) in your code

item.Value.ToString.Substring(0,3) = “000"


That’s weird because in most languages that use 0 based indexing, (0,2) would be three digits. But your suggestions worked, thank you.