Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. string format on decimal value

string format on decimal value

Scheduled Pinned Locked Moved ASP.NET
questionhtml
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    firestoper
    wrote on last edited by
    #1

    HI Gurus, How can I format 50000 integer to this format 50,000? I tried using string.format("{0:#,#}", variable) but the result always come with a decimal value 50,000.00 Thanks dom

    C A R 3 Replies Last reply
    0
    • F firestoper

      HI Gurus, How can I format 50000 integer to this format 50,000? I tried using string.format("{0:#,#}", variable) but the result always come with a decimal value 50,000.00 Thanks dom

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I think it's string.format("0:f2") ( for two points after the decimal )

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • F firestoper

        HI Gurus, How can I format 50000 integer to this format 50,000? I tried using string.format("{0:#,#}", variable) but the result always come with a decimal value 50,000.00 Thanks dom

        A Offline
        A Offline
        Arun Immanuel
        wrote on last edited by
        #3

        int i=50000; i=i.ToString("##,###"); Please try this...

        1 Reply Last reply
        0
        • F firestoper

          HI Gurus, How can I format 50000 integer to this format 50,000? I tried using string.format("{0:#,#}", variable) but the result always come with a decimal value 50,000.00 Thanks dom

          R Offline
          R Offline
          RaghuSanta
          wrote on last edited by
          #4

          Hi, The format is String.Format("{0:#,###}", 50000) Regards, Raghu

          F 1 Reply Last reply
          0
          • R RaghuSanta

            Hi, The format is String.Format("{0:#,###}", 50000) Regards, Raghu

            F Offline
            F Offline
            firestoper
            wrote on last edited by
            #5

            Thanks Raghu this one nail it! you rock!:cool:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups