我正在尝试拆分一个 csv 列表。
csvList=你好,你好吗,你叫什么名字\,再次
我必须使用 Java split 函数来获取三个组件:
hello there
how are you
what is your name, again
我想转义前面有“\”的逗号。 有人可以帮忙吗?
谢谢。
最佳答案
您可以使用 lookbehind egex:
String[] tok="hello there, how are you, what is your name\\, again".split(" *(?<!\\\\), *");
关于java - 转义时如何使用 CSV 拆分\,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22673705/