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
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Managed c++ float/double/integer to String and vice-versa?

Managed c++ float/double/integer to String and vice-versa?

Scheduled Pinned Locked Moved Managed C++/CLI
questionc++
4 Posts 2 Posters 11 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.
  • Y Offline
    Y Offline
    yehiga1467
    wrote on last edited by
    #1

    Hello, I am trying to display float/double/integer to a string with custom format in Label. But I couldn't find snprintf available in managed c++. How can I achieve this?

    V 1 Reply Last reply
    0
    • Y yehiga1467

      Hello, I am trying to display float/double/integer to a string with custom format in Label. But I couldn't find snprintf available in managed c++. How can I achieve this?

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      Did you try ToString method?

      int count = 100;
      System::String^ s = count.ToString();

      Y 1 Reply Last reply
      0
      • V Victor Nijegorodov

        Did you try ToString method?

        int count = 100;
        System::String^ s = count.ToString();

        Y Offline
        Y Offline
        yehiga1467
        wrote on last edited by
        #3

        Hello, I have tried ToString(), but I could not format to the how many decimal places to display .

        V 1 Reply Last reply
        0
        • Y yehiga1467

          Hello, I have tried ToString(), but I could not format to the how many decimal places to display .

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #4

          Then use ToString() with the format specifications. See the example: [Converting Double To System::string^ - C And C++ | Dream.In.Code](https://www.dreamincode.net/forums/topic/98077-converting-double-to-systemstring/)

          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