我有来自csv文件的行,如
"abc@example.com","seattle,US","9999 00000"
预期产出:
abc@example.com
seattle,US
9999 00000
string.Split(',')
时的实际输出:
"abc@example.com"
"seattle
US"
"9999 00000"
答案 0 :(得分:0)
如果您使用"
字符来限定列,则可以按","
string input = "\"abc@example.com\",\"seattle,US\",\"9999 00000\"";
string[] result = input.Trim('"').Split(new string[] { "\",\"" }, StringSplitOptions.None);