[英]how to add double quotes after '=' symbol in nsstring?
I have a weird issue, were I need to add "" after '=' symbol in nsstring. 我有一个奇怪的问题,我需要在nsstring中的'='符号后添加“”。 Below is the example 以下是示例
NSString *codes = [NSString stringWithFormat:@"%@",sessionToken];
NSString *slash = [NSString stringWithFormat:@"auth session_token=%@",codes]; << here I have to add the "".
i have tried with 我试过了
NSString *slash = [NSString stringWithFormat:@"auth session_token=\"%@\"",codes];
but it didn't work the result is showing like this \\"value\\"
. 但它不起作用,结果显示像这样的\\"value\\"
。
A backslash (\\)
followed by a quotation mark (")
will inserts the quotation mark into NSString. 反斜杠(\\)
后跟引号(")
将引号插入NSString。
NSString *slash = [NSString stringWithFormat:@"auth session_token=\"%@\"",@"1233"];
NSLog(@"slash %@", slash);
Output is 输出是
[23273:a0f] slash auth session_token="1233"
Is it possible to include a quotation mark as part of an nsstring? 是否可以在引号中包含引号?
try this: 尝试这个:
NSString *slash = [NSString stringWithFormat:@"auth session_token=""""""",codes];
I've recently done some thing similar and this seemed to work for me 我最近做了一些相似的事情,这似乎对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.