There is a line 1,2,3, "4, A", B, 5, C, 6,7,8. Can you please tell me how to break it up into substrings by a comma but skipping a comma + space? Below is the code that works, maybe there is a simpler option?
String s = "1,2,3,\"4, A\",B, 5,C,6,7,8"; String[] ss; s = s.replaceAll(", ", "#%&"); // меняем "запятая + пробел" на любой символ ss = s.split(","); for (int i = 0; i < ss.length; i++) { System.out.println(ss[i].replaceAll("#%&", ", ")); // возвращаем запятую с пробелом обратно }