Character replacing in Xcode - Objective-C

iphone, nsstring, objective-c, string

Solution

descString = [descString stringByReplacingOccurrencesOfString:@"\\n" withString:@""];

For more information refer to stringByReplacingOccurrencesOfString:withString: method

Hope this helps you.

UPDATE

Swift 3.0

descString.replacingOccurrences(of: "\\n", with: "");

and If I am not wring it will also work for Swift 4.0

Problem

I have used this code for replacing "\n" with "", but it is not working. How can I do it? ``` NSString *descString = [values objectForKey:@"description"]; descString = [descString stringByReplacingOccurrencesOfString:@"\n" withString:@""]; NSLog(@"Description String ---->>> %@",descString); catlog.description = descString; [webview loadHTMLString:catlog.description baseURL:nil]; webview.opaque = NO; ```

Original source

Related problems