Advertisement
Guest User

Untitled

a guest
May 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. public boolean xyzThere(String str)
  2. {
  3. String testStr = str;
  4. int pos = 0;
  5. while ((pos = testStr.indexOf("xyz")) >= 0) {
  6. if (pos == 0) return true;
  7. if (testStr.charAt(pos-1) != '.') return true;
  8.  
  9.  
  10. testStr = testStr.substring(pos+1);
  11. }
  12. return false; // no luck
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement