Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean xyzThere(String str)
- {
- String testStr = str;
- int pos = 0;
- while ((pos = testStr.indexOf("xyz")) >= 0) {
- if (pos == 0) return true;
- if (testStr.charAt(pos-1) != '.') return true;
- testStr = testStr.substring(pos+1);
- }
- return false; // no luck
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement