NSString *str = "/r/n你好吗";
str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符
str = [str stringByReplacingOccurrencesOfString:@"
" withString:@""];
str = [str stringByReplacingOccurrencesOfString:@"
" withString:@""];