Reputation: 1059
What character would act as a wild card in Objective-C? I have tried using *, but no luck. I am trying to get a value that is passed through a URL like this:
NSString *clearQuery = [query stringByReplacingOccurrencesOfString:@"q=set&mode=*&session=" withString:@""];
I need it to return only the session value. The mode could be a lot of things. Thanks for the help.
Upvotes: 0
Views: 974
Reputation: 44331
Use NSRegularExpression or rangeOfString:...
with NSRegularExpressionSearch
instead. -[NSString stringByReplacingOccurrencesOfString:]
matches literal strings, not patterns of any sort.
Upvotes: 2
Reputation: 25632
There is no such wildcard.
You might look into the new NSRegularExpression
class, but this needs 4.0 at minimum.
Upvotes: 0