Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (12.7k points)
edited by

I trying to find the syntax where I can use Not keyword with String.Contains condition in UIPath.

Example: I have the following variable.

strValue = “This is Test”

I want to check whether the 'Test' word does not exist in the variable then it should show me some message.

I have tried the below approach but it did not work.

Not strValue.Contains(“Test”)

1 Answer

0 votes
by (29.5k points)

The command indexOf() returns -1 if the value to the search is not present in the string. I have mentioned a sample code below:

strValue = “This is Test”
var i = strValue.indexOf("Test");
if(i>0){
  console.log('Test is present in strValue');
}

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...