fork download
  1. class TesteRegex {
  2. public static void main(String[] args) {
  3. String s = " A B C ";
  4. String[] d = s.split(" ", 5);
  5. System.out.println(d.length);
  6. for (int i = 0; i < d.length; i++) {
  7. System.out.println("[" + d[i] + "]");
  8. }
  9. }
  10. }
Success #stdin #stdout 0.1s 27708KB
stdin
Standard input is empty
stdout
5
[]
[A]
[B]
[C]
[]