java - Split line with with several spaces -
i have text file in have take line line.
for each line have cut string , put in table.
my separator space.
example of string:
22/03/2013 00h00 9940 10200 10260 10190 10030 10060
example of result:
[22/03/2013 00h00, 9940, 10200, 10260, 10190, 10030, 10060]
my problem in file, separator varies 1 line another
example:
22/03/2013 00h00 9940 10200 10260 10190 10030 10060 22/03/2013 01h00 9970 9900 9970 9850 9830 9740 22/03/2013 02h00 9630 9750 10010 10100 10040 10010
how cut string ?
you can try regex
str.split("(?<!/\\d{4}) +");
Comments
Post a Comment