Click here to Skip to main content
12,511,553 members (49,451 online)
Click here to Skip to main content
Add your own
alternative version

Stats

7K views
1 bookmarked
Posted

.NET 4: string.IsNullOrWhitespace()

, 12 Aug 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
public static class StringExtensions { public static bool IsNullOrWhitespace(this string s) { if (null == s) return true; return string.IsNullOrEmpty(s.Trim()); } }
public static class StringExtensions
    {
        public static bool IsNullOrWhitespace(this string s)
        {
            if (null == s) return true;
            return string.IsNullOrEmpty(s.Trim());
        }
    }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

jfriedman
Software Developer (Senior) ASTI Transportation Inc.
United States United States
Livin in a lonely world, caught the midnight train going anywhere... Only thing is it was a runaway train... and it ain't ever goin back...

v//

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralThank you for clarifying however... Whitespace variants can... Pin
jfriedman13-Aug-10 10:30
memberjfriedman13-Aug-10 10:30 
GeneralRe: I assist carrol_jhara in the broader definition of <B>White<... Pin
Andreas Gieriet26-Feb-12 10:48
memberAndreas Gieriet26-Feb-12 10:48 
GeneralReason for my vote of 2 will fail on whitespaces variants Pin
carrol_jhara12-Aug-10 18:46
membercarrol_jhara12-Aug-10 18:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160929.1 | Last Updated 12 Aug 2010
Article Copyright 2010 by jfriedman
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid