Xcode “逃跑”;在NSString中,stringWithFormat被愚弄了

Xcode “逃跑”;在NSString中,stringWithFormat被愚弄了,xcode,macos,cocoa,nested,stringwithformat,Xcode,Macos,Cocoa,Nested,Stringwithformat,我用 但实际的NSString包括\ 例如,如果sourceescape=test和destinationDirectory=test,我希望NSString包含: NSString *copyCommand=[NSString stringWithFormat:@"put \"%@\" \"%@\"",sourceEscaped,destinationDirectory]; 而不是 put "test" "test" 请注意下面示例中的directoryCommand: 您的问题不清楚。你

我用

但实际的NSString包括\

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

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

put "test" "test"
请注意下面示例中的directoryCommand:


您的问题不清楚。你指的是哪个“\”?输入字符串是什么(
storageID
destinationDirectory
sourceEscaped
),您希望得到什么输出?当你说“高度不一致”时,它是以什么方式不一致的?更新为Clarity这只是调试器视图,它在字符串中转义引号。使用
NSLog(@“cmd=%@”,directoryCommand)
进行验证,或者在调试器控制台中尝试
po directoryCommand
。@MartinR实际上您的评论是一个答案,您可能应该将其作为答案来写以关闭此问题。同意-它确实回答了。
put \"test\" \"test\"