Split text with '\r\n'

前端 未结 8 434
予麋鹿
予麋鹿 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:08

    This worked for me.

    using System.IO;
    
    //  
    
        string readStr = File.ReadAllText(file.FullName);          
        string[] read = readStr.Split(new char[] {'\r','\n'},StringSplitOptions.RemoveEmptyEntries);
    

提交回复
热议问题