OC判断是http还是https开头

2017-06-05  本文已影响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");

```

上一篇下一篇

猜你喜欢

热点阅读