Reputation: 446
I retrieve NSData
from a server containing \n
. When I convert it into an NSString
, \n
is not working. It prints "\n".
My code is like this:
NSString *st=[NSString stringWithFormat:@"%@",data];
Thanks
Upvotes: 0
Views: 158
Reputation: 1544
That may help you.
myString = [myString stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
Upvotes: 0
Reputation: 2052
Try with this:
NSString * string = [[NSString alloc] initWithData:yourData encoding:NSUTF8StringEncoding];
Upvotes: 1