fork download
  1. class Example
  2. {
  3. public static void main(String[] args)
  4. {
  5. String str = "foo:and:boo";
  6. test("Results from using just \"o\":", str, "o");
  7. test("Results from using \"o+\":", str, "o+");
  8. }
  9.  
  10. private static void test(String label, String str, String rex)
  11. {
  12. String[] results = str.split(rex);
  13. System.out.println(label);
  14. for (String result : results) {
  15. System.out.println("[" + result + "]");
  16. }
  17. }
  18. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
Results from using just "o":
[f]
[]
[:and:b]
Results from using "o+":
[f]
[:and:b]