标签:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
//字符串拼接
NSString *str1=@"pear",*str2=@"apple";
//字符串格式化输出
NSString *newstr=[[NSString alloc]initWithFormat:@"拼接后%@ %@",str1,str2];
NSLog(@"%@",newstr);
NSString *newstr1=[str1 stringByAppendingString:str2];
NSLog(@"%@",newstr1);
//字符串格式化拼接
NSString *newstr2=[str1 stringByAppendingFormat:@"-%@",str2];
NSLog(@"%@",newstr2);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/haitong-0311/p/5120340.html