Link to home
Start Free TrialLog in
Avatar of tanc02
tanc02

asked on

match string ?

I have a str = "abcdef567jhg";

How do I match above string if it has 567, then return 0;
ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
to return  0 or 1

return str.matches(".*567.*") ? 0 : 1;
Glad I could help and Thanx for the "A"