Format double - thousands separator with decimal b

2019-03-30 11:35发布

I am looking for a format to use with string.Format that would print the following

double d = 123456.123456D;
double d2 = 123456D;

like

123,456.123456
123,456

{0:N6} results in

123,456.123456
123,456.000000

{0:0.######} results in

123456.123456
123456

{0:#.0} results in

123,456
123,456

I cannot workout a format that will get me to what I need. Will I need to define my own format provider ?

标签: c# string format
1条回答
爷、活的狠高调
2楼-- · 2019-03-30 11:48

You're close. Use this format:

{0:#,0.######}
查看更多
登录 后发表回答