How to check the string contains particular Number in uiPath
How to check the string contains particular Number in uiPath
In UiPath, you often need to check if a string contains certain words. The “.Contains” method is a quick way to see if a substring is present, but it’s not always accurate. For example, if you’re checking if a string says ” 0 collections,” using .Contains(“0 collections”) might give you the wrong result if the string is ” 10 collections”—it will still return True, which is incorrect.
To avoid this, you can use the “.Equals” method instead. .Equals checks if the entire string matches exactly what you’re looking for. So, if you use:
Conclusion:
This will only return True if the string is exactly “0 collections.” It won’t mistake “0 collections” for the correct answer.
In short, use .Equals when you need precision, and only use .Contains when you don’t care about the exact match. This small change can make your UiPath automation much more reliable!