How can I convert a string with newlines in it to separate lines?

前端 未结 5 401
感情败类
感情败类 2021-01-23 21:46

How to convert string that have \\r\\n to lines?

For example, take this string:

string source = \"hello \\r\\n this is a test \\r\\n tested\         


        
5条回答
  •  余生分开走
    2021-01-23 22:46

    Try

    string[] items = source.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
    

提交回复
热议问题