I have the following line of code:
NSLog([NSString stringWithFormat:NSLocalizedString(@"KEY", nil),80.1]);
The 80.1 is a float that is being inserted into the localized string. This works fine. However I want a % symbol in the localized string. I have tried using %%, but it does not output the % symbol – instead it outputs a space, the numbers 5302 and also removes part of the string that precedes the %% characters.
How can I add a % symbol to a string returned by NSLocalizedString?
I think the problem is not with the
NSLocalizedString, but withNSLog‘s interpretation of%symbol. If you pass a format string toNSLog, and put the string that you would like to show as an object parameter, the percentage sign%should survive: