namespace Umbraco.Tests
{
static class StringNewLineExtensions
{
///
/// Ensures Lf only everywhere.
///
/// The text to filter.
/// The filtered text.
public static string Lf(this string text)
{
if (string.IsNullOrEmpty(text)) return text;
text = text.Replace("\r", ""); // remove CR
return text;
}
///
/// Ensures CrLf everywhere.
///
/// The text to filter.
/// The filtered text.
public static string CrLf(this string text)
{
if (string.IsNullOrEmpty(text)) return text;
text = text.Replace("\r", ""); // remove CR
text = text.Replace("\n", "\r\n"); // add CR everywhere
return text;
}
}
}