1、去除字符串的首尾空格2、去除字符串首尾空格 1、去除字符串的首尾空格[textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 2、去除字符串首尾空格[textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];