Я следил за этой статьей
И я придумал этот код:
string FileName = "C:\\test.txt";
using (StreamReader sr = new StreamReader(FileName, Encoding.Default))
{
string[] stringSeparators = new string[] { "\r\n" };
string text = sr.ReadToEnd();
string[] lines = text.Split(stringSeparators, StringSplitOptions.None);
foreach (string s in lines)
{
Console.WriteLine(s);
}
}
Вот пример текста:
somet interesting text\n
some text that should be in the same line\r\n
some text should be in another line
Вот результат:
somet interesting text\r\n
some text that should be in the same line\r\n
some text should be in another line\r\n
Но я хочу, чтобы это:
somet interesting textsome text that should be in the same line\r\n
some text should be in another line\r\n
Я думаю, что я должен получить этот результат, но почему-то я чего-то не хватает...