1

I'm trying to split a string of the following format (with x possible numbers in the lists) into two different strings :

"9 7 20 -3 4” “1 2 0 -6"

I know how to split a string, but only by one character (a space for example)

I wouldn't know what to do to split this into two strings by their quotation marks.

And after having split these into two different strings, I don't know how to split the lists themselves into an array of numbers (since there is an x number of possible numbers).

Adrien Aacha
  • 109
  • 2
  • 8

1 Answers1

2

Do You mean to split with this regex ”\\s+“:

String str = "9 7 20 -3 4” “1 2 0 -6";
String spl[] = str.split("”\\s+“");

Outputs

[9 7 20 -3 4, 1 2 0 -6]
ziMtyth
  • 1,008
  • 16
  • 32