NSString *_string = [NSString stringWithFormat:@"123 456"]; NSRange _range = [_string rangeOfString:@" "]; if (_range.location != NSNotFound) {
//有空格
}else {
//没有空格 }