c# - format number with 3 trailing decimal places, a decimal thousands separator, and commas after that -


this simple question, , i'm sure there's way string.format(), numberformatinfo, cultureinfo or combination of them, need display large numeric values 3 trailing decimal places, decimal instead of comma thousands separator, , comma millions separator , up.

the input either whole number or number followed 3 decimal places (20000, 123.456, 12.2)

for example:

142650 should display 142,650.000

11200.50 should display 11,200.500

123.456 should remain 123.456

i suppose it's same dividing value 1000 , using string.format("{0:f3}", value), hoping find didn't take arithmetic.

string.format("{0:#,#.000}", value) gets me close, puts leading 0 on small numbers, 1.256 displaying 01.256, when need remain 1.256

the format string.format("{0:#,0.000}", value) ended doing me. works whole numbers , numbers anywhere 1 3 trailing decimal places.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -