mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 13:45:05 +00:00
add isnullorwhitespace helper
This commit is contained in:
@@ -475,6 +475,21 @@ namespace ICD.Common.Utils
|
|||||||
return text == null ? null : new string(text.Where(c => !Char.IsWhiteSpace(c)).ToArray());
|
return text == null ? null : new string(text.Where(c => !Char.IsWhiteSpace(c)).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the string is entirely whitespace characters, or empty, or null.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsNullOrWhitespace(string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(text))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var trimmed = text.Trim();
|
||||||
|
return trimmed.Length == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the password as a series of *s
|
/// Returns the password as a series of *s
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user