美文网首页
iOS - 去除字符串首尾空格、换行

iOS - 去除字符串首尾空格、换行

作者: HanZhiZzzzz | 来源:发表于2018-10-17 21:28 被阅读0次
  1. 去除首尾空格
NSString *title = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

  1. 去除首尾换行
NSString *title = [title stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
  1. 去除首尾空格和换行
NSString *title = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

摘自:https://blog.csdn.net/zhoupengju/article/details/52168926

相关文章

网友评论

      本文标题:iOS - 去除字符串首尾空格、换行

      本文链接:https://www.haomeiwen.com/subject/jhldzftx.html