Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. String line = "3::Daniel::Louis||##2::Leon: the Professional::1994||6::Jean::Reno||7::Gary::Oldman||8::Natalie::Portman||##3::Scarface::1983||9::Al::Pacino||10::Michelle::Pfeiffer";
  2.  
  3. for(String s : line.split("||##")) {
  4. System.out.println("|"+s+"|");
  5. }
  6.  
  7. ||
  8. |3|
  9. |:|
  10. |:|
  11. |D|
  12. |a|
  13. |n|
  14. |i|
  15.  
  16. 3::Daniel::Louis
  17.  
  18. Leon: the Professional
  19.  
  20. line.split("\|\|##"))
  21.  
  22. \|
  23.  
  24. |
  25.  
  26. for (String s : line.split("\|\|##"))
  27.  
  28. Pattern p = Pattern.compile("\|\|##", Pattern.LITERAL)
  29. String[] result = p.split(myString)
  30.  
  31. for(String s : line.split("\|\|##")) {
  32.  
  33. for(String s : line.split("\Q||##\E")) {
  34.  
  35. Iterable<String> frags = Splitter.on("||##").split(line);
  36. // Do whatever with the iterable...maybe you just want a list?
  37. // List<String> fragList = Lists.newArrayList(frags);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement