何かのようなもの:
String str = ";onor Oyj,Native,Uor Oyj1,\"Uponor Oyj, UBS, Innovation AB\",39639d4d26:-21f7;";
char[] c = str.toCharArray();
boolean inQuote = false;
for (int i = 0; i < c.length; i++)
{
if (c[i] == ',' && !inQuote)
c[i] = '\01'; // some value that doesn't appear in the string
if (c[i] == '"')
inQuote = !inQuote;
}
String[] arr2 = String.valueOf(c).split("\\01");
for (String s: arr2)
{
System.out.println(s);
}
出力:
;onor Oyj
Native
Uor Oyj1
"Uponor Oyj, UBS, Innovation AB"
39639d4d26:-21f7;
に置き換えString[] arr2 = String.valueOf(c).split("\\01");
てString[] arr2 = String.valueOf(c).replaceAll("\"", "").split("\\01");
、引用符を削除します。