首页 > 代码库 > NSString去空格和换行

NSString去空格和换行

NSString* headerData=http://www.mamicode.com/@"阿斯达阿萨德按时大大a

大声道


啊实打实";

headerData = http://www.mamicode.com/[headerData stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符

       headerData = http://www.mamicode.com/[headerDatastringByReplacingOccurrencesOfString:@"/r" withString:@""];

       headerData = http://www.mamicode.com/[headerDatastringByReplacingOccurrencesOfString:@"/n" withString:@""];

NSString去空格和换行