Split text with '\r\n'

前端 未结 8 465
予麋鹿
予麋鹿 2020-12-28 12:42

I was following this article

And I came up with this code:

string FileName = \"C:\\\\test.txt\";

using (StreamReader sr = new StreamReader(FileNam         


        
8条回答
  •  余生分开走
    2020-12-28 13:05

    Following code gives intended results.

    string text="some interesting text\nsome text that should be in the same line\r\nsome 
    text should be in another line"
    var results = text.Split(new[] {"\n","\r\n"}, StringSplitOptions.None);
    

提交回复
热议问题