去掉空格、替换字符

去掉首尾空格

NSString *str = [orderString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

替换字符 (将空格替换为无,即为去掉字符串中所有的空格)

NSString *str = [orderString stringByReplacingOccurrencesOfString:@" " withString:@""];

你可能感兴趣的:(去掉空格、替换字符)