我有以下数据要分割:
1111 | AAA | DDDD | CCC00021 | RR13 | 600999922 | 101111287 | 0 | 0 | 2011-06-20 15:38:31.549000 | 2011-06-30 08:57:20.114000 2222 | BBB | DDDD | CCC00031 | RR15 | 600911122 | 101000287 | 0 | 0 | 2011-06-20 15:38:31.549000 | 2011-06-30 08:57:20.114000 3333 | AAA | DDDD | CCC11021 | RR01 | 600955522 | 101122287 | 0 | 0 | 2011-06-20 15:38:31.549000 | 2011-06-30 08:57:20.114000
像每一行一样对待它们。我需要存储每个元素 获得输出:
1111
AAA
DDDD
CCC00021
RR13
600999922
101111287
0
0
2011-06-20 15:38:31.549000
2011-06-30 08:57:20.114000
下一行
2222
BBB
DDDD
CCC00031
RR15
600911122
101000287
0
0
2011-06-20 15:38:31.549000
2011-06-30 08:57:20.114000
下一行
3333
AAA
DDDD
CCC11021
RR01
600955522
101122287
0
0
2011-06-20 15:38:31.549000
2011-06-30 08:57:20.114000
我正在使用Scanner类。
答案 0 :(得分:0)
代码:
String var = "1111|AAA|DDDD|CCC00021|RR13|600999922|101111287|0|0|2011-06-20 15:38:31.549000|2011-06-30 08:57:20.114000 2222|BBB|DDDD|CCC00031|RR15|600911122|101000287|0|0|2011-06-20 15:38:31.549000|2011-06-30 08:57:20.114000 3333|AAA|DDDD|CCC11021|RR01|600955522|101122287|0|0|2011-06-20 15:38:31.549000|2011-06-30 08:57:20.114000"
for(String x : var.split("\\|")){
System.out.println(x);
}