首页 > 移动平台 > 详细

stringByAppendingPathComponent、stringByAppendingString等语句的区别

时间:2015-11-05 22:16:07      阅读:361      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!