码迷,mamicode.com
首页 > 移动开发 > 详细

stringByAppendingPathComponent、stringByAppendingString等语句的区别

时间:2015-11-05 22:16:17      阅读:466      评论:0      收藏:0      [点我收藏+]

标签:

NSString *a1=@"Hello";
NSString *a2=@"World";
 
NSString *and1=[a1 stringByAppendingString:a2];
NSString *and2=[a1 stringByAppendingPathComponent:a2];//Append附加,path路径,component组成
NSString *and3=[a1 stringByAppendingPathExtension:a2];//extension扩大,延长(扩展名)
NSString *and4=[a1 stringByAppendingFormat:@"_123456_%@",a2];//format格式
  
NSLog(@"%@",and1);
NSLog(@"%@",and2);
NSLog(@"%@",and3);
NSLog(@"%@",and4);
/*******************************/
2015-11-05 20:52:12.500 test[10068:192356] HelloWorld
2015-11-05 20:52:12.501 test[10068:192356] Hello/World
2015-11-05 20:52:12.501 test[10068:192356] Hello.World
2015-11-05 20:52:12.502 test[10068:192356] Hello_123456_World
/*******************************/
 

stringByAppendingPathComponent、stringByAppendingString等语句的区别

标签:

原文地址:http://www.cnblogs.com/liuyingjie/p/4940948.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!