使用NSString 去掉前后空格或回车符 2025-06-19 技术 想要去掉字符串的前后空格和回车符,很简单,如下: 1234NSString *string = @" spaces in front and at the end ";NSString *trimmedString = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSLog(trimmedString); 最后更新时间:2025-06-19 10:36:59 永久链接:https://blog.gowhich.com/2025/06/19/%E4%BD%BF%E7%94%A8NSString-%E5%8E%BB%E6%8E%89%E5%89%8D%E5%90%8E%E7%A9%BA%E6%A0%BC%E6%88%96%E5%9B%9E%E8%BD%A6%E7%AC%A6.html 赏 Prev Django 错误 Non-ASCII character '\xe6' Next NGINX禁止直接以IP访问