如何使用目标c将整数​​添加到String中?

Tat*_*tat 12 syntax objective-c

我是一个java程序员,我发现Java在做字符串时非常gd.如果我想做这个目标c,我怎么能在目标c中做:

System.out.println("This is a " + 123 + " test");
Run Code Online (Sandbox Code Playgroud)

Sev*_*yev 34

要将整数放入字符串,可以执行以下操作:

int n = 123;
NSString *s = [NSString stringWithFormat:@"This is a %d test", n];
Run Code Online (Sandbox Code Playgroud)

还有很多其他方法.但是用+运算符连接整数字符串并不是其中之一.:)