NSString with \n or line break

newline, nsstring, objective-c

Solution

I just ran into the same issue when overloading -description for a subclass of NSObject. In this situation I was able to use carriage return (\r) instead of newline (\n) to create a line break.

`[NSString stringWithFormat:@"%@\r%@", mystring1,mystring2];`

Problem

Does anyone know how to use line breaks in NSString? I need to do something like this - ``` [NSString stringWithFormat:@"%@,\n%@", mystring1,mystring2]; ```

Original source