iphone--字符串去除空格

 NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];

  NSString * stringStr = [self.titleField.text stringByTrimmingCharactersInSet:whitespace];//stringStr为self.titleField.text去掉空格后的字符串

  NSLog(@"去除空格之后的标题%@",stringStr);

你可能感兴趣的:(whitespace)