Created
September 4, 2013 12:47
-
-
Save leberwurstsaft/6436459 to your computer and use it in GitHub Desktop.
Whitespace Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSString (Stuff) | |
- (BOOL)containsOnlyWhiteSpace; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSString+Stuff.h" | |
@implementation NSString (Stuff) | |
- (BOOL)containsOnlyWhiteSpace { | |
return ([self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment