Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. String s = "O Jesus - Jesus Jesus-O - Jesus - O -O";
  2. s.replaceAll(" - ", "-"); <- This only replaces first spacy-hyphen with hyphen
  3.  
  4. "O Jesus-Jesus Jesus-O-Jesus-O-O";
  5.  
  6. s = s.replaceAll("\s*-\s*", "-");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement