iOS--NSString---过滤换行符和空白字符

参考文章:http://www.2cto.com/kf/201301/186676.html

NSString * headerData = model.content;
headerData = [headerData stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符
headerData = [headerData stringByReplacingOccurrencesOfString:@”\r” withString:@”“];
headerData = [headerData stringByReplacingOccurrencesOfString:@”\n” withString:@”“];

    label.text = [NSString stringWithFormat:@"通知:%@",headerData];

2015年07月03日11:53:36 mark__yll

你可能感兴趣的:(NSString)