fork download
  1. import java.util.*;
  2. class Ideone {
  3. public static void main (String[] args) {
  4. String[] strings = {
  5. "TOWN ALe Alx Aus Bau Bem Bra Clq Crk DLk",
  6. "AlbertLea - - 22 - - - - - - -"
  7. };
  8. Arrays.stream(strings)
  9. .map(s -> s.split("(?<=\\s)(?=\\S)"))
  10. .map(Arrays::toString)
  11. .forEach(System.out::println);
  12. }
  13. }
Success #stdin #stdout 0.44s 2841600KB
stdin
Standard input is empty
stdout
[TOWN                 , ALe   , Alx   , Aus   , Bau   , Bem   , Bra   , Clq   , Crk   , DLk]
[AlbertLea              , -     , -    , 22     , -     , -     , -     , -     , -     , -     , -]