Make newline comparison work crossplat

This commit is contained in:
Ajay Bhargav Baaskaran 2018-04-20 11:05:26 -07:00
parent 5504374125
commit 2be905def4
1 changed files with 3 additions and 1 deletions

View File

@ -26,8 +26,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
public static bool IsNewLine(string value)
{
// We want to handle both LF and CRLF regardless of the platform.
// We explicitly check for CRLF and IsNewLine() should return true for LF.
return (value.Length == 1 && (IsNewLine(value[0]))) ||
(string.Equals(value, Environment.NewLine, StringComparison.Ordinal));
(string.Equals(value, "\r\n", StringComparison.Ordinal));
}
public static bool IsIdentifier(string value)