逃避"在NSString stringWithFormat是愚蠢的

时间:2017-03-10 12:44:35

标签: xcode macos cocoa nested stringwithformat

我用

NSString *copyCommand=[NSString stringWithFormat:@"put \"%@\" \"%@\"",sourceEscaped,destinationDirectory];

但实际的NSString包含\

例如,如果sourceEscaped = test和destinationDirectory = test我希望NSString包含:

put "test" "test"

而不是

put \"test\" \"test\"

请注意以下示例中的directoryCommand:

enter image description here

0 个答案:

没有答案