I want to log an NSString but when I log it, it doesn't show the new line character " n". How can I make it so it does? Thanks.
Asked
Active
Viewed 1.1k times
1 Answers
17
You can process the string first and replace all occurrences of \n
with \\n
NSString *newString = [originalString stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];

jjwchoy
- 1,898
- 16
- 20
-
4Parameters are reversed. I had to use [originalString stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"] – railwayparade Jan 15 '13 at 03:19