Iphone ToolTiHTML-从google地图调用中提取

Iphone ToolTiHTML-从google地图调用中提取,iphone,regexkitlite,Iphone,Regexkitlite,2.1\x26160;英里/7分钟 我有上面的字符串,我只需要到达距离和时间。我将如何使用RegexKitLite脚本执行此操作?理想情况下,以下是我正在寻找的: 时间=7分钟 距离=2.1英里 谢谢不要使用RegexKitLite脚本,但我是这样做的: NSString*ToolTiptML=[apiResponse stringByMatching:@ToolTiptML:\\\[^\\]*\\捕获:1L] NSLog(@"tooltip Html: %@", tooltipHtml);

2.1\x26160;英里/7分钟

我有上面的字符串,我只需要到达距离和时间。我将如何使用RegexKitLite脚本执行此操作?理想情况下,以下是我正在寻找的:

时间=7分钟 距离=2.1英里


谢谢

不要使用RegexKitLite脚本,但我是这样做的:

NSString*ToolTiptML=[apiResponse stringByMatching:@ToolTiptML:\\\[^\\]*\\捕获:1L]

NSLog(@"tooltip Html: %@", tooltipHtml);


int leftParanthesis = [tooltipHtml rangeOfString:@"("].location;
int inverseSlash = [tooltipHtml rangeOfString:@"\\"].location;
int slash = [tooltipHtml rangeOfString:@"/"].location;
int semiColumn = [tooltipHtml rangeOfString:@";"].location;
int rightParanthesis = [tooltipHtml rangeOfString:@")"].location;


NSRange distanceRange = NSMakeRange(leftParanthesis+1, inverseSlash-leftParanthesis-1);
NSString *distance = [tooltipHtml substringWithRange:distanceRange];

NSRange distanceTypeRange = NSMakeRange(semiColumn+1, slash-semiColumn-1);
NSString *distanceType = [tooltipHtml substringWithRange:distanceTypeRange];

NSRange timeRange = NSMakeRange(slash+1, rightParanthesis-slash-1);
NSString *time = [tooltipHtml substringWithRange:timeRange];
NSString *distanceCompact = [distance stringByAppendingString:distanceType];

NSLog(@"Distance %@:", distance);
NSLog(@"Distance type %@:", distanceType);
NSLog(@"Time %@:", time);
NSLog(@"distance Compact %@:", distanceCompact);