判断是否是网络连接url
- 作者: 9578471884
- 来源: 51数据库
- 2022-08-17
// 是否是网络连接url
- (BOOL)isInternetLink:(NSString *)linkOrPath
{
NSString * regexStr =@"http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?";
if (!linkOrPath) {
return NO;
}
NSPredicate *strPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regexStr];
return [strPredicate evaluateWithObject:linkOrPath];
}
推荐阅读
