String.Format decimal with two thousand separators and forced decimal places

I would like a String.Formatdecimal number, so that it contains both thousands of separators and forced decimal numbers (3).

For instance:

Input:

123456,12
78545,8

Conclusion:

123.456,120
78.545,800

I tried

String.Format("{0:0.0,000}", input);

but it gives only thousands of separators, but not the power of decimal places.

+4
source share
3 answers

(.) " ". . , . (,) .

, , ( ).

, :

 String.Format("{0:#,##0.000}", input);

( # , , input .)

+5
String.Format("{0:N3}", input)

N

+3

:

string.Format("{0:N3}", input)

( ):

string.Format("{0:#,##0.000}", input)
+1
source

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


All Articles