代码展示:
由于服务器返回的字符串有回车与/n自己设置的xib的label显示装不下了,所以初次下策也没通知服务端自己改一下吧.
NSString *str = fault.fault_content;
str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符
str = [str stringByReplacingOccurrencesOfString:@"
" withString:@""];
str = [str stringByReplacingOccurrencesOfString:@"
" withString:@""];
//str就是去掉的string