i need to split this string
"5294-Process Done-03-12-2014 09:22:20-20-4537-Active-No-61240-ADBC DEF-NE IHK SMR-MCF-FMAP"
to
"5294,Process Done,03-12-2014 09:22:20,20,4537,Active,No,61240,ADBC DEF-NE IHK SMR-MCF-FMAP".
Thanks for Helping
String s="5294-Process Done-03-12-2014 09:22:20-20-4537-Active-No-61240-ADBC DEF-NE IHK SMR-MCF-FMAP";
String[] v1= s.substring(0, 18).split("-");
String s1=s.substring(19, 37);
String[] v2= s.substring(38, 61).split("-");
String s2=s.substring(62, s.length()-1);
List<String> lst = new ArrayList<String>();
for(String a:v1){
lst.add(a);
}
lst.add(s1);
for(String b:v2){
lst.add(b);
}
lst.add(s2);
System.out.println(lst.toString());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.