For some odd reason, my stringByTrimmingCharacterInSet: allows the '%' through.
Why?
Simple code that demonstrates the issue (meant to extra a phone # from text):
NSString * allowedSet = @"01234567890+-#";
NSCharacterSet * disallowedSet =[[NSCharacterSet characterSetWithCharactersInString:allowedSet] invertedSet];
in = @"+31%121212abc";
out = [in stringByTrimmingCharactersInSet:disallowedSet];
I would have expected as the output
... In : +31%121212abc
... Out : +31121212
but I am getting:
... In : +31%121212abc
... Out : +31%121212
Why is that? It seems to work for pretty much all other chars. Is the '%' special - or is this some odd URL related issue?