Return to Snippet

Revision: 13052
at January 6, 2010 15:51 by Anthony


Updated Code
public static bool IsNullOrEmpty(this string input)
{
    if (string.IsNullOrEmpty(input))
        return true;

    return string.IsNullOrEmpty(input.Trim());
}

Revision: 13051
at April 6, 2009 13:48 by Anthony


Initial Code
public static bool IsNullOrEmptyOrWhitespace(string input)
{
    if (string.IsNullOrEmpty(input))
        return true;

    return string.IsNullOrEmpty(Regex.Replace(input, @"\s+", ""));
}

Initial URL


Initial Description


Initial Title
Extension method to test whether a string is null or empty or whitespace

Initial Tags
regex

Initial Language
C#