ios NSNotFound的基本用法
来源:互联网 发布:帝国cms 调用相关内容 编辑:程序博客网 时间:2024/05/17 01:08
例一:
NSString *_string = [NSStringstrinWithFormat:@"123 456"];
NSRange _range = [_stringrangeOfString:@" "];
if (_range.location != NSNotFound){
//有空格
}else{
//没有空格
}
先查找空格的位置,然后查找到不到位置的即为-1.可以知道是否有空格
例二:
if ([videoURL rangeOfString:@"http://".location!=NSNotFound|| [videoURL rangeOFString:@"https://"].location != NSNotFound] )
{
//网络请求格式正常
}else{
//网络请求格式不是以http或者https开头的
}
NSNotFound是用来判断这个字符串是否符合网络请求格式,即以http或https开头。NSNotFound字面理解就好。
0 0
- ios NSNotFound的基本用法
- IOS - rangeOfString、NSNotFound
- IOS - rangeOfString、NSNotFound
- iOS UILabel的基本用法
- iOS CoreData的基本用法
- ios NSTimer的基本用法
- iOS委托的基本用法
- iOS分类的基本用法
- iOS 通知的基本用法
- iOS 通知的基本用法
- iOS UIWebView的基本用法
- iOS--NSAttributedString的基本用法
- iOS NSScanner的基本用法
- IOS的GCD基本用法
- iOS-Objective-C中的nil、Nil、NULL、NSNull、NSNotFound总结
- iOS开发之NSPredicate的基本用法
- ios--UITabBarController的基本用法3
- iOS多线程GCD的基本用法
- IOS TableView的Cell高度自适应,UILabel自动换行适应
- sqlite时间类型
- Oracle Job 语法和时间间隔的设定
- C++运算符学习笔记之++i与i++
- c++初试-仿函数(11)
- ios NSNotFound的基本用法
- Eclipse is running in a JRE, but a JDK is required错误的解决
- memcached+magent实现memcached集群
- 值得收藏的几个网站
- 移动App架构设计
- Luogu考前模拟Round2总结
- 图像处理-线性滤波-3 高斯滤波器
- (五)OSAL--操作系统抽象层 初始化流程分析
- subline 编辑器的配置与使用