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.
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#?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.