标签:style blog io ar color sp strong on div
代码:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"判断字符串是否为空"; NSLog(@"--字符串是否为空-%i-",[self isBlankString:@"123455"]); } //判断字符串是否为空 - (BOOL) isBlankString:(NSString *)string { if (string == nil || string == NULL) { return YES; } if ([string isKindOfClass:[NSNull class]]) { return YES; } if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) { return YES; } return NO; }
输出:
2014-12-08 11:02:31.303 判断字符串是否为空[7256:60b] --字符串是否为空-0-
标签:style blog io ar color sp strong on div
原文地址:http://www.cnblogs.com/yang-guang-girl/p/4150602.html