I have reading everything and \" does NOT work.
I am trying to create a string that looks like this:
"SomeString" = "AnotherString"
Here is the code that I have to insert the double quotes:
NSString *newOutput = [NSString stringWithFormat:@"%@ \" = \" %@", output, [englishDic objectForKey:str]];
All that it outputs is:
"RateThisAppDontAsk \" = \" Don't ask again"
I thought maybe the "=" was causing problems but removing still gives me an output of this:
"RateThisAppDontAsk \" \" Don't ask again"
Any help would be very much appreciated!
Works for me in a little MacOS X command line test program. Here's all the code:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSString *newOutput = [NSString stringWithFormat:@"%@ \" = \" %@", @"foo", @"bar"];
NSLog(newOutput);
}
return 0;
}
Output is:
test[54844:403] foo " = " bar
If you want quotes before foo and after bar, add those:
NSString *newOutput = [NSString stringWithFormat:@"\"%@\" = \"%@\"", @"foo", @"bar"];
New output is:
test[54873:403] "foo" = "bar"
NSString *output = @"RateThisAppDontAsk";
NSString *nextString = @"Don't ask again";
NSString *newOutput = [NSString stringWithFormat:@"\"%@\" = \"%@\"", output, nextString];
NSLog(@"%@",newOutput);
Output
"RateThisAppDontAsk" = "Don't ask again"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With