Reputation: 17591
I have two problem:
first:
I have a NSSTring as @"abcdef\n" , I want to delete from this string "\n", how can I do?
second:
if I have a string as @"abcdef \n", I don't know how is long space, but I want only text of this nsstring
thanks
Upvotes: 1
Views: 215
Reputation: 6139
[@"abcdef\n" stringByReplacingOccurrencesOfString:@"\n" withString:@""];
[@"abcdef \n" stringByReplacingOccurrencesOfString:@" " withString:@""];
Upvotes: 2
Reputation: 5857
Just replace all occurrences of \n with empty string like this:
myString = [myString stringByReplacingOccurrencesOfString:@"\n" withString:@""];
Upvotes: 1