1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
- (NSString *) paramValueOfUrl:(NSString *) url withParam:(NSString *) param value:(NSString *)value{ NSError *error;
NSString *targetString = [NSString stringWithFormat:@"%@=%@",param,value];
NSString *regTags = [[NSString alloc] initWithFormat:@"%@=+([\\w]*)",param];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regTags options:0 error:&error];
NSString *string = [regex stringByReplacingMatchesInString:url options:0 range:NSMakeRange(0, [url length]) withTemplate:targetString];
return string; }
|