在引号外部以逗号为分隔符进行拆分。
我的程序从文件中读取一行。这一行包含以逗号分隔的文本,如下所示:
123,test,444,"don't split, this",more test,1
我希望分割的结果是这样的:
123
test
444
"don't split, this"
more test
1
如果我使用String.split(",")
,得到的结果将是这样的:
123
test
444
"don't split
this"
more test
1
换句话说:子字符串"don't split, this"
中的逗号不是分隔符。如何处理这个问题?