Hello Reader ,
I have situation where I need to is a string contains sub string or not for example
String1= “Welcome To eggplant world”
in the above string I need to verify if “eggplant” exists or not
How can we do that
Thanks in advance
Hello Reader ,
I have situation where I need to is a string contains sub string or not for example
String1= “Welcome To eggplant world”
in the above string I need to verify if “eggplant” exists or not
How can we do that
Thanks in advance
Hallo bihaavan,
there are lots of variants to do this. The simpliest form ist just to code:
put “eggplant” is in String1
But eggplant also supports RegEx. For complex searches pls. have a look to the match operator in Using Patterns.
BR
The code provided by GammaG is correct. Alternately, based on preference, you can use the contains
keyword.
put string1 contains "eggplant" -- true
Hope this helps,
Dave