目标c引用和变量

1 variables quotes xcode objective-c

我正在尝试做这样的事情:

NSAppleScript *sendCharlieImput = [[NSAppleScript alloc] initWithSource:@"tell application \"terminal\" to do script " charlieImputSelf " in front window"];
[sendCharlieImput executeAndReturnError:nil];
Run Code Online (Sandbox Code Playgroud)

变量charlieImputSelf将作为命令放入终端窗口.但我需要将charlieImputSelf放在2个qoutes之间(如上所述).这显然不是正确的方法.有人可以帮忙吗?

谢谢!以利亚

bbu*_*bum 10

要获得成功,您需要接受文档. 从这里开始.然后去读这个.

沿着不得不就每一行代码提出问题的道路走下去并不会带来成功.

要回答这个问题,您需要stringWithFormat::

[NSString stringWithFormat: @"some random string \"with quotes\" and %@ word in the middle.", @"this"]; 
Run Code Online (Sandbox Code Playgroud)