Add IsMultiline(string) extension method
Add IsMultiline(string)
extension method for string
.
Following the spirit of #43, should probably also implement extensions for char[]
, Span<char>
, and ReadOnlySpan<char>
.
Reference Implementation
public static bool IsMultiline(this string self)
{
if (self is null) { throw new NullReferenceException(); }
if (self.Length == 0) { return false; }
for (int index = 0; index < self.Length; index++)
{ if (self[index] is '\r' or '\n') { return true; } }
return false;
}