String extensions - siof/common.extensions GitHub Wiki
String extensions
ReplaceSafe
string ReplaceSafe(this string str, char from, char to)
string ReplaceSafe(this string str, string from, string to)
Same as String.Replace but with checking if object exists.
IsEmptyOrWhiteSpace
bool IsEmptyOrWhiteSpace(this string str)
Same as string.IsNullOrWhiteSpace but can be used as object method.
IsNotEmptyOrWhiteSpace
bool IsNotEmptyOrWhiteSpace(this string str)
Result of !str.IsEmptyOrWhiteSpace()
TrimSafe TrimStartSafe TrimEndSafe
string TrimSafe(this string str, params char[] trimChars)
string TrimStartSafe(this string str, params char[] trimChars)
string TrimEndSafe(this string str, params char[] trimChars)
Same as String.Trim/String.TrimStart/String.TrimEnd but with checking if object exists.
IsAlfaNumeric
bool IsAlfaNumeric(this string str)
Simplification for str.IfNotNull(strVal => strVal.All(char.IsLetterOrDigit), false)