Reputation: 1213
i am new to iphone. i want to eliminate chars from %0A onwards in below url string and %20 also.please any one give some solns.
case:1
http://www.sampleurl.com-feb 1.2161280%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
case:2
%0A%20%20%20%20%20%20http://www.sampleurl.com-feb.html%0A%20%20%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20
in case 2 also, want to eliminate chars before and after url.
Upvotes: 1
Views: 157
Reputation: 81878
Your strings look like they are url encoded and contain whitespace at the beginning and end.
NSString* decodedString = [myString stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString* cleanedString = [decodedString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
Now cleanedString
is what you are looking for.
Upvotes: 4