Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Character replacing in Xcode - Objective-C

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;
like image 205
Manann Sseth Avatar asked Aug 30 '26 20:08

Manann Sseth


1 Answers

try this

NSString *s = @"foo/bar:baz.foo";
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"/:."];
s = [[s componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @""];
NSLog(@"%@", s);
like image 146
Heer Makwana Avatar answered Sep 02 '26 11:09

Heer Makwana