I need to split a string into array.
String test = "test (18,2,3) ,(,Test (,)), Test";
I am expecting to split by commas that are NOT within the brackets. This is what I need
test (18,2,3)
(,Test (,))
Test
I tried
String test = "test (18,2,3) , (,Test (,)) , Test";
String colVals [] = test.split("[^(.*,.*)] | ,");
System.out.println(colVals[0]);
System.out.println(colVals[1]);
System.out.println(colVals[2]);
But the result was not what I was expecting
Aucun commentaire:
Enregistrer un commentaire