String(localized:) return \' as thousands separator

Just found something weird with the String(localized:) method.

Let's say that I have a "%lld apples" sentence inside a string catalog.

If I call

String(localized:"\(1000) apples") 

when on the device settings the number format is "1'234'567.89" and the device language is English, then the following string is returned:

1\'000 apples

Any idea why the ' character has a backslash? It's a bug or I miss something?

Thank you

Answered by DaleOne in 771870022

Never mind. I was printing the string in the console with the "po" command, like so:

po String(localized:"\(1000) apples")

For some reason when using "po", all ' characters inside strings are displayed with a backslash.

For example this:

po "1'000" 

will output this:

"1\'000" 
Accepted Answer

Never mind. I was printing the string in the console with the "po" command, like so:

po String(localized:"\(1000) apples")

For some reason when using "po", all ' characters inside strings are displayed with a backslash.

For example this:

po "1'000" 

will output this:

"1\'000" 
String(localized:) return \' as thousands separator
 
 
Q