How do you test if an NSString is empty

-(BOOL) isEmptyString:(NSString*) string {
   
if([string length]==0){//string is empty or nil
       
return YES;
   
}elseif([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0){
     
//string is all whitespace
       
return YES;
   
}
   
return NO;
}
posted @ 2012-07-09 17:37  Season2009  阅读(240)  评论(0编辑  收藏  举报