编写 CSV 时,"\",\x0A\x0D" 代码在 C# 中做了什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9021649/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 05:37:42  来源:igfitidea点击:

what "\",\x0A\x0D" code does in C# while writing CSV

c#csv

提问by user1171738

Can anybody please tell me what its checking in following condition.

任何人都可以告诉我在以下条件下检查什么。

if (s.IndexOfAny("\",\x0A\x0D".ToCharArray()) > -1)

采纳答案by Sani Singh Huttunen

It's checking if there is any Quotation Mark ", Comma ,, a Line Feed \x0Aor Carriage Return \x0Din the string s.

它正在检查字符串中是否有任何引号"、逗号,、换行符\x0A或回车\x0Ds

\x0Ais the escaped hexadecimal Line Feed. The equivalent of \n.
\x0Dis the escaped hexadecimal Carriage Return. The equivalent of \r.

\x0A是转义的十六进制换行符。相当于\n
\x0D是转义的十六进制回车符。相当于\r

回答by Barry Kaye

\x0A\x0Dare escaped hexadecimal carriage return and line feed characters.

\x0A\x0D是转义的十六进制回车符和换行符。