tanc02
asked on
match string ?
I have a str = "abcdef567jhg";
How do I match above string if it has 567, then return 0;
How do I match above string if it has 567, then return 0;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did that work for you?
If you are us JDK1.4, try regular expressions.
str.matches(".*567.*");
This will return true if it matches this pattern.
str.matches(".*567.*");
This will return true if it matches this pattern.
to return 0 or 1
return str.matches(".*567.*") ? 0 : 1;
return str.matches(".*567.*") ? 0 : 1;
Glad I could help and Thanx for the "A"