Created
May 23, 2017 11:19
-
-
Save 5ZSQ/f84e1f94a2633a200d147f55ca79a21f to your computer and use it in GitHub Desktop.
iOS - NSString拼接字符串
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString* string; // 结果字符串 | |
NSString* string1, string2; //已存在的字符串,需要将string1和string2连接起来 | |
//方法1. | |
string = [NSString initWithFormat:@"%@,%@", string1, string2 ]; | |
//方法2. | |
string = [string1 stringByAppendingString:string2]; | |
//方法3 . | |
string = [string stringByAppendingFormat:@"%@,%@",string1, string2]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment