The new String.IsNullOrWhiteSpace method

Published Fri, Apr 2 2010 21:56

It was only yesterday that I’ve noticed this new static method. As you probably expected from its name, the IsNullOrWhiteSpace method will only return true for a null string  or for a string which contains only white-space chars (ie, tabs, spaces, etc). Small but handy addition.

Filed under:

Comments

# Joao Cardoso said on Monday, April 05, 2010 7:12 AM

I would prefer one like IsNullOrTrimEmpty . That way no matter the number os spaces I would get true. :) You gotta love extension methods :D

# luisabreu said on Monday, April 05, 2010 8:03 AM

I guess that would probably be better...btw, how do extension methods help here? (or are you thinking in using an extension method call after checking for the IsNullOrWhiteSpavce method?)

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above:  

Search

This Blog

Tags

Community

Archives

Syndication

Email Notifications

News




  • View Luis Abreu's profile on LinkedIn


    Follow me at Twitter

    My books

    Silverlight 4.0: Curso Completo

    ASP.NET 4.0: Curso Completo

    Portuguese LINQ book cover

    Portuguese ASP.NET 3.5 book cover

    Portuguese ASP.NET AJAX book cover

    Portuguese ASP.NET AJAX book cover