NSRange 使用...
来源:互联网 发布:网络项目70000元 编辑:程序博客网 时间:2024/06/08 15:14
#import <Foundation/Foundation.h>int main(int argc, const char * argv[]){@autoreleasepool {NSString * str1 = @"123ios123itcast123ios111ios";NSString * str2 = @"ios";NSRange range = [str1 rangeOfString:str2];NSRange temp; // 只能创建一个 range 再赋值 , 再代入参数列表里吗? 有没有直接写法? 有// 方法1://temp.location = 5;//temp.length = 22;// 方法2:// temp = (NSRange){5,22};// 方法3://NSRange temp = { 5, 22 };// 方法4://NSRange temp = {.location = 5, .length = 22 };// 方法5: OC新增的方法, 上面的是传统C的赋值方式temp = NSMakeRange(5, 22);NSRange range2 = [str1 rangeOfString:str2 options:NSLiteralSearch range:temp];// NSNotFound == NSIntegerMaxif (range.location != NSNotFound) { //查看结构体方法1:NSLog(@"%lu,%lu", range.location, range.length); //方法2:NSLog(@"%@", NSStringFromRange(range));}else {NSLog(@"not found ");}//==============================if (range2.location != NSNotFound) {NSLog(@"%lu,%lu", range2.location, range2.length);NSLog(@"%@", NSStringFromRange(range2));}else {NSLog(@"not found ");}}return 0;}
0 0
- NSRange 使用...
- 字符串NSRange的使用
- OC NSRange的使用
- NSRange--
- NSRange
- NSRange
- NSRange
- NSRange
- NSRange
- NSRange
- iOS之NSRange的使用
- 黑马程序员--NSRange的使用
- 黑马程序员 - OC语言 - NSRange使用(范围)
- NSPoint、NSSize、NSRect、NSRange使用与Bool细节
- OC中字符串的方法使用(NSString、NSMutableString、NSRange)
- 黑马程序员——OC语言加强---NSRange使用
- foundation的使用——NSRange NSPoint NSSize NSRect
- NSRange Exception
- 系统时间的差别
- libaio linux 原生异步io
- draw的this.parent在前面才行
- .Net实现文件下载Demo
- Could not clean server of obsolete files: 前言中不允许有内容。前言中不允许有
- NSRange 使用...
- where does root (/) mount point exist — linux
- svn服务器地址变换以后,mac下的处理方法
- 把选中的商品信息传到另外一个页面
- 博客搬家了,搬家了
- Error: "select_city_zzdw" is not translated in "zh" (Chinese) [MissingTranslation]
- layer-list(图层叠加)
- ig.Entity.inject 植入属性
- 文章标题:HDU 2717 Catch That Cow