For example, a string that formats a numeric format string-----currency-----. ToString ("C");. ToString ("C"), Example 2.5.ToString ("C")->¥2.50-----decimal-----. ToString ("D");. ToString ("D"); example 123.ToString ("D8")--00000123-----Science Count-----. ToString ("E");. ToString ("E");-----fixed-point-----. ToString ("F");. ToString ("F"), example 25.ToString ("F2"), 25.00-----General-----. ToString ("G");. ToString ("G"), Example 2.5.ToString ("G"), 2.5-----Digital-----. ToString ("N");. ToString ("n"), example 2500000.ToString ("n"), 2,500,000.00-----percentage-----. ToString ("P");. ToString ("P"), Example 0.125.ToString ("P"), 12.5%-----round-trip process-----. ToString ("R");. ToString ("R"),-----any single character-----. ToString (); custom numeric format string format description 0 decimal left rounded decimal Right placeholder # non 0 o'clock digit placeholder. decimal point, thousand separator% multiplied by 100 plus% indicates \ escape sequence ' string ' "string; Split positive negative and 0 format string data type value output ##### double 123 12300000 Double 123 00123 (# # # # # # # # # # # # # # # # # 1234 567890 (123) 456–7890#.## double 1.2 1.20.00 double 1.2 1.2000.00 double 1.2 01.20# , # Double 1234567890 1,234,567,890#, double 1234567890 1235#,,, double 1234567890 1#,# #0, double 1 234567890 1,235#0.##% Double 0.086 8.6%0.## #E +0 double 86000 8.6e+40.## #E +000 Doub Le 86000 8.6e+0040.## #E -000 double 86000 8.6e004[##-##-##] double 123456 [12-34-56 ]##;(# #) Double 1234 1234##;(# #) Double-1234 (1234)
"Reprint" C # number format ToString Method