Skip to content

Instantly share code, notes, and snippets.

@dabing1022
Created May 7, 2015 09:02
Show Gist options
  • Save dabing1022/3696b1ce8cb265c4c037 to your computer and use it in GitHub Desktop.
Save dabing1022/3696b1ce8cb265c4c037 to your computer and use it in GitHub Desktop.
- (NSArray *)matchUrlInString:(NSString *)string
{
NSError *error = NULL;
NSDataDetector *detectorLink = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error];
NSArray *urlMatchArr = [detectorLink matchesInString:string options:NSMatchingReportCompletion range:NSMakeRange(0, string.length)];
return urlMatchArr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment