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
试试这个:
NSString * string = [[NSString alloc] initWithData:yourData encoding:NSUTF8StringEncoding];
那可能对您有帮助。
myString = [myString stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.