From 27ec28459ce0f092d4e34b5909fbc1d9fca75223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Sun, 6 Dec 2020 22:45:50 +0100 Subject: [PATCH] [`ParsedFile.ReadAllGroupsOfLines`] Make \r replacement safer by replacing the whole \r\n group with \n. --- src/FileParser/Implementations/ParsedFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FileParser/Implementations/ParsedFile.cs b/src/FileParser/Implementations/ParsedFile.cs index f21af8e..aed0306 100644 --- a/src/FileParser/Implementations/ParsedFile.cs +++ b/src/FileParser/Implementations/ParsedFile.cs @@ -117,7 +117,7 @@ public string ToSingleString(string wordSeparator = " ", string? lineSeparator = public static List> ReadAllGroupsOfLines(string path) { return File.ReadAllText(path) - .Replace("\r", "") + .Replace("\r\n", "\n") .Split("\n\n") .Where(str => !string.IsNullOrEmpty(str)) .Select(str => str.Split('\n', StringSplitOptions.RemoveEmptyEntries).ToList())