More content refactoring (tests)

This commit is contained in:
Stephan
2017-11-10 11:27:12 +01:00
parent 09f499d5d6
commit fcf2b27953
121 changed files with 1459 additions and 2400 deletions

View File

@@ -761,7 +761,6 @@ namespace Umbraco.Core
return stringToConvert.GenerateHash("SHA1");
}
/// <summary>Generate a hash of a string based on the hashType passed in
/// </summary>
/// <param name="str">Referrs to itself</param>
@@ -950,6 +949,18 @@ namespace Umbraco.Core
return input.Replace("\r", "").Replace("\n", "");
}
/// <summary>
/// Converts to single line by replacing line breaks with spaces.
/// </summary>
public static string ToSingleLine(this string text)
{
if (string.IsNullOrEmpty(text)) return text;
text = text.Replace("\r\n", " "); // remove CRLF
text = text.Replace("\r", " "); // remove CR
text = text.Replace("\n", " "); // remove LF
return text;
}
public static string OrIfNullOrWhiteSpace(this string input, string alternative)
{
return !string.IsNullOrWhiteSpace(input)