标签:
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