String.Format with NumberGroupSeparator outputting 0xa0 not a comma

I see strange results when running string.Format ("C");

eg.

    double val = 123456.78;
    Console.WriteLine( val.ToString( "C" ) );

This prints the thousands separator as 0xa0, not a comma (0x2c).

I get the same result if I use string.Format( "{0:0,0.00}", 1234567.12D );

Here is the complete conclusion

R 123ΓΏ456.78
52333A333233
201230456C78

My regional settings are English (South African), and I get the same result on multiple machines.

Any ideas?

Thank.

+3
source share
1 answer

It looks like this has already been answered by Space in the .NET string returned by the string. The format does not match the space declared in the source code .

0xa0 - NO-BREAK SPACE, thanks dtb

+1
source

Source: https://habr.com/ru/post/1748032/


All Articles