设为首页 加入收藏

TOP

学习ios【2】Objective-C 数字和字符串(三)
2017-10-13 10:29:12 】 浏览:2032
Tags:学习 ios Objective-C 数字 字符串
mutable String A
//追加字符 [mstr appendString:@" and String B"]; NSLog(@"%@",mstr);//This is mutable String A and String B //删除子串 [mstr deleteCharactersInRange:NSMakeRange(16, 8)]; NSLog(@"%@",mstr);//This is mutable and String B //查找子串并删除 substr=[mstr rangeOfString:@"and String B"]; if(substr.location!=NSNotFound){ [mstr deleteCharactersInRange:substr]; NSLog(@"%@",mstr);//This is mutable } //直接设置可变字符串内容 [mstr setString:@"This is String."]; NSLog(@"%@",mstr);//This is String. //替换子串 [mstr replaceCharactersInRange:NSMakeRange(7, 1) withString:@" mutable "]; NSLog(@"%@",mstr);//This is mutable String.

 

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇多线程之NSOperation和NSOperatio.. 下一篇正则运算校验手机号码

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目