- 去除首尾空格
NSString *title = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- 去除首尾换行
NSString *title = [title stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
- 去除首尾空格和换行
NSString *title = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
摘自:https://blog.csdn.net/zhoupengju/article/details/52168926
网友评论