This question already has an answer here:
这个问题在这里已有答案:
- Is it possible to include a quotation mark as part of an nsstring? 6 answers
是否可以在引号中包含引号? 6个答案
i want to initialize NSString is as "hai" with double qoutes..is it possible? any help please? but NSString *str = @"hai"; i want to convert it as "hai" without direct initialization?any help pls?
我想初始化NSString是双haoutes的“hai”..它可能吗?有什么帮助吗?但是NSString * str = @“hai”;我想将它转换为“hai”而无需直接初始化?有什么帮助吗?
2 个解决方案
#1
6
If you want to convert an existing string please use this:
如果要转换现有字符串,请使用:
NSString *newString = [NSString stringWithFormat:@"\"%@\"",str];
#2
2
NSString* foo = @"\"hai\"";
NSString * foo = @“\”hai \“”;
#1
6
If you want to convert an existing string please use this:
如果要转换现有字符串,请使用:
NSString *newString = [NSString stringWithFormat:@"\"%@\"",str];
#2
2
NSString* foo = @"\"hai\"";
NSString * foo = @“\”hai \“”;