美文网首页
ios字符串中网址的方法(系统)

ios字符串中网址的方法(系统)

作者: iOS劝退师 | 来源:发表于2019-07-10 10:28 被阅读0次

NSError* error =nil;

    NSDataDetector *dataDetector=[NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error];

    NSArray *allMatches=[dataDetector matchesInString:attributeString.string options:NSMatchingReportProgress range:NSMakeRange(0, attributeString.string.length)];

    for(NSTextCheckingResult*matchinallMatches) {

        NSString*substrinsgForMatch2 = [attributeString.stringsubstringWithRange:match.range];

    }

相关文章

网友评论

      本文标题:ios字符串中网址的方法(系统)

      本文链接:https://www.haomeiwen.com/subject/fosckctx.html