String test = "[\"String 1\",\"String, two\"]";
String[] embeddedStrings = test.split("<insert magic regex here>");
//note: It should also work for this string, with a space after the separating comma: "[\"String 1\", \"String, two\"]";
assertEquals("String 1", embeddedStrings[0]);
assertEquals("String, two", embeddedStrings[1]);
내가 첫 번째 단계로 대괄호를 트리밍 괜찮아. 하지만, 비록 내가 그렇게하더라도, 쉼표는 쉼표로 구분할 수 없습니다. 왜냐하면 포함 된 문자열에 쉼표를 사용할 수 있기 때문입니다. Apache StringUtils 사용도 가능합니다.
출력 결과는 항상 'String 1'과 'String, two'가됩니다. 나는 쉼표로 구분하고, 묶인 필드를 인용했습니다. 따옴표는 선택 또는 필수입니까? – jabbie