object c求nsstring 长度和去掉前后空格的方法

 object c求nsstring 长度和去掉前后空格的方法

 

NSString *searchText = [[searchBar text] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];

if ([searchText length] > 0){

self.keyWordRecord.query = searchText;

self.title = searchText;

[self startDownLoadDataFromInternet];

}

NSLog(@"searchText:%@",searchText);

你可能感兴趣的:(NSString)