I want to check whether string contains particular sub string and using CONTAINS() for it.
But here problem is with space.
Ex- str1= “c not in(5,6)”
I want to check whether str contains NOT IN so I am using str.contains(“not in”)..
But problem is that here space between NOT and IN is not decided i.e. there can be 5 spaces also..
How to solve that I can find sub string like not in with any no of spaces in between…
You should use a regex:
"not\\s+in"Explanation: The
\\s+means any kind of white space [tab is also acceptable], and must repeat at least one [any number >=1 will be accepted].If you want only spaces, without tabs change your regex to
"not +in"