我正在尝试执行以下操作(伪)
NSString *variable = 'Name';
NSString *newString = @"Hello, " + variable + @" blah blah";
看来它并不像上面的那么简单!有什么帮助吗?
谢谢
我正在尝试执行以下操作(伪)
NSString *variable = 'Name';
NSString *newString = @"Hello, " + variable + @" blah blah";
看来它并不像上面的那么简单!有什么帮助吗?
谢谢
NSString *str = @"Hello, ";
str = [str stringByAppendingString:variable];
str = [str stringByAppendingString:@" blah blah"];
如果你喜欢它作为一行语句
NSString *str = [[@"Hello, " stringByAppendingString:variable] stringByAppendingString:@" blah blah"];
迅速
var str = "Hello, " + varaible + "blah blah"
或者
var str = "Hello, \(variable) blah blah"
NSString *newString = [NSString stringWithFormat:@"Hello, %@ blah blah", variable];