美文网首页
OC判断是http还是https开头

OC判断是http还是https开头

作者: 炸街程序猿 | 来源:发表于2017-06-05 22:16 被阅读0次

```

NSString *jsPath = @"https://dog.abcdef.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy.js";

// 判断是否是“https://”开头

[jsPath hasPrefix:@"https://"];

// 判断是否是“.js”结尾

[jsPath hasSuffix:@".js"];

// 判断是否包含“abcdef”

if([jsPath rangeOfString:@"abcdef"].location==NSNotFound) {

        NSLog(@"不包含abcdef");

 } else {

        NSLog(@"包含abcdef");

```

相关文章

网友评论

      本文标题:OC判断是http还是https开头

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