/ Published in: C#
Expand |
Embed | Plain Text
public static bool IsNullOrEmpty(this string input) { if (string.IsNullOrEmpty(input)) return true; return string.IsNullOrEmpty(input.Trim()); }
Comments
Subscribe to comments
You need to login to post a comment.

Using Regex is probably overkill here; a more efficient alternative would simply be (on the last line): return string.IsNullOrEmpty(input.Trim()); although it includes more characters than the regex version.
Thanks GothikX. I always assumed that Trim only got rid of spaces, which is why I used the RegEx. Your comment caused me to actually look at the docs on MSDN. Looks like Microsoft has updated it a little since VB5. :-) Thanks again.