去掉换行之后最后一个字符

2019-01-10  本文已影响5人  一笑wangx

NSString *officeS = [self customModel:[NSString stringWithFormat:@"%@\n%@-%@\n",self.smokeContentLabel.titleLabel.text,insSmokeModel.smokeAreaName,insSmokeModel.smokeName]];
officeS = [officeS stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符
officeS = [officeS stringByReplacingOccurrencesOfString:@"无" withString:@""];//无 为原字符 @“” 为要替换的字符

上一篇 下一篇

猜你喜欢

热点阅读