第一种:

 NSArray *array = [NSArray arrayWithObjects:@"Hello",@" ",@"world", @"!", nil];
NSString *printStr = @"";
for(int i = ; i < [array count]; i++){
printStr = [printStr stringByAppendingFormat:@"%@", [array objectAtIndex:i]];
}
NSLog(@"第一种方法%@", printStr);

第二种:

 NSArray *array = [NSArray arrayWithObjects:@"Hello",@" ",@"world", @"!", nil];
NSMutableString *printStr2 = [[NSMutableString alloc] init];
for(int i = ; i < [array count]; i++){
[printStr2 appendFormat:@"%@", [array objectAtIndex:i]];
}
NSLog(@"第二种方法%@", printStr2);

输出结果:

-- ::52.964 String追加字符串[:] 第一种方法Hello world!
-- ::52.965 String追加字符串[:] 第二种方法Hello world!

iOS NSString追加字符串的方法的更多相关文章

  1. 【iOS】Swift字符串截取方法的改进

    字符串截取方法是字符串处理中经常使用的基本方法.熟悉iOS的朋友都知道在基础类的NSString中有substringToIndex:,substringFromIndex:以及substringWi ...

  2. iOS NSString拼接字符串

    NSString* str_C; // 结果字符串NSString* str_A, str_B; //已存在的字符串,需要将str_A和str_B连接起来 //方法1 str_C = [NSStrin ...

  3. iOS NSString中的搜索方法rangeOfString

    NSString *str = @"your://aaa?backscheme=my"; //在str中查找“backscheme=”,并返回一个NSRange类型的值,我们可以通 ...

  4. iOS NSString中字符串的删除,替换

  5. NSString 截取字符串

    NSString字符串常用方法2010-09-06 14:18/******************************************************************** ...

  6. iOS中的字符串NSString

    创建一个字符串对象: NSstring * str1 = @"hello world"; NSString * str = [[NSString alloc]initWithStr ...

  7. [转] NSString / NSMutableString 字符串处理,常用代码

     原文 :  http://justcoding.iteye.com/blog/1405951 Objective-C 中核心处理字符串的类是 NSString 与 NSMutableString , ...

  8. 【转】 NSString / NSMutableString 字符串处理,常用代码 (实例)

    Objective-C 中核心处理字符串的类是 NSString 与 NSMutableString ,这两个类最大的区别就是NSString 创建赋值以后该字符串的内容与长度不能在动态的更改,除非重 ...

  9. NSString / NSMutableString 字符串处理,常用代码 (实例)

    http://blog.csdn.net/likendsl/article/details/7417878 Objective-C 中核心处理字符串的类是 NSString 与 NSMutableSt ...

随机推荐

  1. jquery-3 jquery选择器

    jquery-3 jquery选择器 一.总结 一句话总结:选择器使用的时候可以结合参考手册,里面都已经详细归类好了.(多用才能熟啊) 1.$(:input).css({'color':'#98765 ...

  2. 【codeforces 602E】Kleofáš and the n-thlon

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  3. Redis学习笔记4-Redis配置具体解释

    在Redis中直接启动redis-server服务时, 採用的是默认的配置文件.採用redis-server   xxx.conf 这种方式能够依照指定的配置文件来执行Redis服务. 依照本Redi ...

  4. 微信小程序开发实战视频教程发布

    昨日(9月23),腾讯终于发布了没有APPid,无需申请也可以进行微信小程序开发的视频教程了,我在在第一时间尝试并发布了这7个小视频教程,入门足够了.... 各位免费拿去,慢慢享用: 链接: http ...

  5. centos 软件安装的三种方式

    Linux下面安装软件的常见方法: 1.yum 替你下载软件 替你安装 替你解决依赖关系 点外卖 缺少的东西 外卖解决 1).方便 简单2)没有办法深入修改 yum install -y tree 2 ...

  6. Dictionary实现(收藏的)

    源文献:https://www.cnblogs.com/InCerry/p/10325290.html 对于C#中的Dictionary类相信大家都不陌生,这是一个Collection(集合)类型,可 ...

  7. RabbitMq核心概念和术语

    简介 越来越多的消息中间件很容易让人产生混淆,在学习一种消息中间件的时候,最好先了解他的几种抽象概念,方便你理解,明白了这些概念,你学习起来的时候也就得心应手,同时也是使用好RabbitMQ的基础. ...

  8. [STM32] IAP不能跳转到APP

    用w5500做网页iap升级, 文件上传正确, 对比内部flash内容也正确, 就是不跳转. 查资料, 怀疑是中断的影响. 在跳转前关闭中断, 问题解决! // IAP程序使用了中断, 跳转前关闭 _ ...

  9. C++中的类与对象模型

    一,C/C++内存模型 1.内存模型分类 栈区:由编译器自动分配和释放,用来存放函数的参数,局部变量.存放在栈中的数据只在当前函数及下一层函数中有效,函数一旦结束,这些数据就被释放了. 堆区:由程序员 ...

  10. Method of Seamless Integration and Independent Evolution of Information-Centric Networking via Software Defined Networking

    A method of transferring data between a software defined network (SDN) and an information-centric ne ...