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. C / C++ / MFC
  4. check for decimal in numerical string

check for decimal in numerical string

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 Posts 5 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.
  • K Offline
    K Offline
    kani98
    wrote on last edited by
    #1

    I have an input box that a user can enter in 4 characters like 1.34. I need to check if there is a decimal in the input string and truncate everything after the tenth place. Is there a C/C++ function that I can use for this? Thanks

    C D D 3 Replies Last reply
    0
    • K kani98

      I have an input box that a user can enter in 4 characters like 1.34. I need to check if there is a decimal in the input string and truncate everything after the tenth place. Is there a C/C++ function that I can use for this? Thanks

      C Offline
      C Offline
      chandu004
      wrote on last edited by
      #2

      will CString :: Find help you?

      1 Reply Last reply
      0
      • K kani98

        I have an input box that a user can enter in 4 characters like 1.34. I need to check if there is a decimal in the input string and truncate everything after the tenth place. Is there a C/C++ function that I can use for this? Thanks

        D Offline
        D Offline
        dtr1
        wrote on last edited by
        #3

        Using "Add memmer variable wizard", add a variable (Category=value) and set ‘Max chars’ to n. Or, DDV_MaxChars(pDX, yourVar, 10); -- modified at 3:50 Saturday 10th November, 2007

        M 1 Reply Last reply
        0
        • D dtr1

          Using "Add memmer variable wizard", add a variable (Category=value) and set ‘Max chars’ to n. Or, DDV_MaxChars(pDX, yourVar, 10); -- modified at 3:50 Saturday 10th November, 2007

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          george.dumitru wrote:

          sing "Add memmer variable wizard", add a variable (Category=value) and set ‘Max chars’ to n.

          How does that find the "decimal in the input string and truncate everything after the tenth place"??? Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • K kani98

            I have an input box that a user can enter in 4 characters like 1.34. I need to check if there is a decimal in the input string and truncate everything after the tenth place. Is there a C/C++ function that I can use for this? Thanks

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            kani98 wrote:

            I need to check if there is a decimal in the input string...Is there a C/C++ function that I can use for this?

            Check out strchr(), or string::find(), or CString::Find().


            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            K 1 Reply Last reply
            0
            • D David Crow

              kani98 wrote:

              I need to check if there is a decimal in the input string...Is there a C/C++ function that I can use for this?

              Check out strchr(), or string::find(), or CString::Find().


              "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              K Offline
              K Offline
              kani98
              wrote on last edited by
              #6

              Is there a C/C++ funciton that will remove a character from a string? I want to remove the decimal from the input string. If someone enter 1.23, I want to use only 1.2, remove the decimal making it 12.

              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