fork download
  1. import java.util.Arrays;
  2.  
  3. class Example {
  4. public static void main(String[] args) {
  5. String str = "1|2|3#1|2";
  6. String[] strs = str.split("#");
  7. String[][] result = new String[strs.length][];
  8. for (int i = 0; i < strs.length; ++i) {
  9. result[i] = strs[i].split("\\|");
  10. }
  11.  
  12. // Show result:
  13. for (String[] a : result) {
  14. System.out.println(Arrays.toString(a));
  15. }
  16. }
  17. }
Success #stdin #stdout 0.06s 32524KB
stdin
Standard input is empty
stdout
[1, 2, 3]
[1, 2]