dimanche 5 avril 2015

Concatenate all non numeric strings in String array

I have a String array like this



String str="9790020760001613 JOHN MATHEWS -66822.60 65000.00 69000.00 -1822.60 KARL MAX";
String[] token = str.split("\\s+");


I wanted to concatenate all the non numeric tokens(e.g JOHN MATHEWS ) till a non numeric token is immediately followed by numeric string so that above token String array would look like this:



[9790020760001613 ,JOHN MATHEWS,-66822.60,65000.00,69000.00,-1822.60,KARL MAX]

Aucun commentaire:

Enregistrer un commentaire