Reputation: 1395
I'm trying to split a var on "\r\n"
Here is my code:
var tempRow = row.InnerText.ToString();
// "\r\n 08:05 PM\r\n 963\r\n Chicago Cubs K. Hendricks -R\r\n \r\n \r\n \r\n \r\n -1½\r\n +130\r\n \t\r\n......"
string[] tempItem = Regex.Split(tempRow.ToString(), @"\\r\\n");
But my tempItem[] doesn't split and has 1 element.
Upvotes: 0
Views: 336
Reputation: 22921
If you're using @
(Verbatim string literal) before the string, you do not need to escape backslashes:
string[] tempItem = Regex.Split(tempRow.ToString(), @"\r\n");
For more information on Verbatim Strings, I highly suggest checking out this link: What's the @ in front of a string in C#?
Upvotes: 2