| 52 | | if(prefixRange.location == NSNotFound) |
|---|
| 53 | | return NULL; |
|---|
| | 52 | while(searchRange.location < searchRange.location + searchRange.length) { |
|---|
| | 53 | prefixRange = [string rangeOfString:@"[" options:0 range:searchRange]; |
|---|
| | 54 | |
|---|
| | 55 | if(prefixRange.location == NSNotFound) |
|---|
| | 56 | break; |
|---|
| | 57 | |
|---|
| | 58 | searchRange.length -= prefixRange.location - searchRange.location + 1; |
|---|
| | 59 | searchRange.location = prefixRange.location + 1; |
|---|
| | 60 | |
|---|
| | 61 | prefix = [string substringWithRange:NSMakeRange(0, prefixRange.location)]; |
|---|
| | 62 | |
|---|
| | 63 | suffixRange = [string rangeOfString:@"]" options:0 range:searchRange]; |
|---|
| | 64 | |
|---|
| | 65 | if(suffixRange.location == NSNotFound) |
|---|
| | 66 | continue; |
|---|
| | 67 | |
|---|
| | 68 | suffix = [string substringWithRange:NSMakeRange(suffixRange.location + 1, [string length] - suffixRange.location - 1)]; |
|---|
| | 69 | |
|---|
| | 70 | rangeString = [string substringWithRange:NSMakeRange(prefixRange.location + 1, suffixRange.location - prefixRange.location - 1)]; |
|---|
| | 71 | array = [rangeString componentsSeparatedByString:@"-"]; |
|---|
| | 72 | |
|---|
| | 73 | if([array count] != 2) |
|---|
| | 74 | continue; |
|---|
| | 75 | |
|---|
| | 76 | start = [[array objectAtIndex:0] unsignedIntValue]; |
|---|
| | 77 | stop = [[array objectAtIndex:1] unsignedIntValue]; |
|---|
| | 78 | |
|---|
| | 79 | if(start == 0 && stop == 0) |
|---|
| | 80 | continue; |
|---|
| | 81 | |
|---|
| | 82 | links = [NSMutableArray arrayWithCapacity:stop - start + 1]; |
|---|
| | 83 | length = [[array objectAtIndex:0] length]; |
|---|
| | 84 | |
|---|
| | 85 | for(i = start; i <= stop; i++) |
|---|
| | 86 | [links addObject:[NSSWF:@"%@%0.*u%@", prefix, length, i, suffix]]; |
|---|
| | 87 | |
|---|
| | 88 | return links; |
|---|
| | 89 | } |
|---|
| 55 | | prefix = [string substringWithRange:NSMakeRange(0, prefixRange.location)]; |
|---|
| 56 | | |
|---|
| 57 | | suffixRange = [string rangeOfString:@"]"]; |
|---|
| 58 | | |
|---|
| 59 | | if(suffixRange.location == NSNotFound) |
|---|
| 60 | | return NULL; |
|---|
| 61 | | |
|---|
| 62 | | suffix = [string substringWithRange:NSMakeRange(suffixRange.location + 1, [string length] - suffixRange.location - 1)]; |
|---|
| 63 | | |
|---|
| 64 | | rangeString = [string substringWithRange:NSMakeRange(prefixRange.location + 1, suffixRange.location - prefixRange.location - 1)]; |
|---|
| 65 | | array = [rangeString componentsSeparatedByString:@"-"]; |
|---|
| 66 | | |
|---|
| 67 | | if([array count] != 2) |
|---|
| 68 | | return NULL; |
|---|
| 69 | | |
|---|
| 70 | | start = [[array objectAtIndex:0] unsignedIntValue]; |
|---|
| 71 | | stop = [[array objectAtIndex:1] unsignedIntValue]; |
|---|
| 72 | | |
|---|
| 73 | | if(start == 0 && stop == 0) |
|---|
| 74 | | return NULL; |
|---|
| 75 | | |
|---|
| 76 | | links = [NSMutableArray arrayWithCapacity:stop - start + 1]; |
|---|
| 77 | | length = [[array objectAtIndex:0] length]; |
|---|
| 78 | | |
|---|
| 79 | | for(i = start; i <= stop; i++) |
|---|
| 80 | | [links addObject:[NSSWF:@"%@%0.*u%@", prefix, length, i, suffix]]; |
|---|
| 81 | | |
|---|
| 82 | | return links; |
|---|
| | 91 | return NULL; |
|---|