"Reprint" C # number format ToString Method

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.