I am writing piece of code to convert line of string into list of string, which has a pattern. After manipulation, need to recreate the pattern with new list of string
pattern (",|x")
Ex: String sampleStr = "10 x 20 x 30, notebook, longsize";
I am able to split using this regex String[] strArray = sampleStr.split(",|x");
after replacing value in array, unable to recreate the pattern for ex( x x , ,).
The pattern may vary to like (x , , ,) X with 3 comma or may be (, , , ,) full comma.
Aucun commentaire:
Enregistrer un commentaire