0

I need to split a string in Java, comma by comma.

The problem is that there's "sub-commas" that I don't want to be splitted.

For example: the string is 12345, "september 7, 2022", lorem ipsum.

Normally, I'd use the split() method, but if I do so, "september 7 and 2022" would be two different indexes of the array of strings.

I apologize in advance for the question's title, I couldn't think of a better one.

Samuel V.
  • 7
  • 2
  • You just need to replace the sub-commas with " " and then replace the space with nothing and then split your String. – SurpriseMF Sep 07 '22 at 20:34

0 Answers0