iOS NSString拼接字符串
2017-02-24 本文已影响1713人
Pandakingli
NSString* str_C; // 结果字符串
NSString* str_A, str_B; //已存在的字符串,需要将str_A和str_B连接起来
//方法1
str_C = [NSString initWithFormat:@"%@,%@", str_A, str_B ];
//方法2
str_C = [str_A stringByAppendingString: str_B];
//方法3
str_C = [string stringByAppendingFormat:@"%@,%@", str_A, str_B];