Created
March 31, 2015 16:34
-
-
Save 2bj/d0e8dae4a3984697a9eb to your computer and use it in GitHub Desktop.
NSString+Extend
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
// | |
// NSString+Extend.h | |
// | |
// Created by Bakyt on 31.03.15. | |
// Copyright (c) 2015 Bakyt. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSString (Extend) | |
- (NSString *)trim; | |
- (bool)isEmpty; | |
- (bool)isNotEmpty; | |
@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
// | |
// NSString+Extend.m | |
// | |
// Created by Bakyt on 31.03.15. | |
// Copyright (c) 2015 Bakyt. All rights reserved. | |
// | |
#import "NSString+Extend.h" | |
@implementation NSString (Extend) | |
- (NSString *)trim | |
{ | |
NSString * str = [self stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
return str; | |
} | |
- (bool)isEmpty | |
{ | |
return self.trim.length == 0; | |
} | |
- (bool)isNotEmpty | |
{ | |
return !self.isEmpty; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment