NSString * link =@"http://localhost/tryy/wapp/index.php?#com_wapp_addcart#urldecode字符串#1";
int j = 0;
NSInteger code_begin = [link length];
NSInteger code_begin_count = 0;
NSMutableArray * strArr = [NSMutableArray array ];
for (int i=0; i<[link length]; i++) {
NSString * c=[link substringWithRange:NSMakeRange(i, 1)];
if([c isEqualToString:@"#"]){
j++;
if (j == 2) {
[strArr addObject:[link substringWithRange:NSMakeRange(code_begin,code_begin_count -1)]];
j = 1;
}
code_begin = i + 1;
code_begin_count = 0;
}
code_begin_count++;
if (i == [link length]-1) {
[strArr addObject:[link substringFromIndex:code_begin]];
}
}
for (NSString * str in strArr) {
NSLog(@"%@",str);
}