Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

csv

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

if (s.IndexOfAny("\",\x0A\x0D".ToCharArray()) > -1)
like image 524
user1171738 Avatar asked Jan 26 '12 16:01

user1171738


2 Answers

\x0A\x0D are escaped hexadecimal line feed and carriage return characters.

like image 41
Barry Kaye Avatar answered Sep 21 '22 10:09

Barry Kaye


It's checking if there is any Quotation Mark ", Comma ,, a Line Feed \x0A or Carriage Return \x0D in the string s.

\x0A is the escaped hexadecimal Line Feed. The equivalent of \n.
\x0D is the escaped hexadecimal Carriage Return. The equivalent of \r.

like image 115
Sani Singh Huttunen Avatar answered Sep 21 '22 10:09

Sani Singh Huttunen