iOS 去除字符串的空格和换行符
2019-04-19 本文已影响0人
它是一只肥猫
1.去除首尾空格:
NSString * content = [textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
2.去除首尾空格和换行:
NSString *content = [textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];