SHARE
TWEET

Untitled

a guest May 19th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Top