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. Count Digits From The String....

Count Digits From The String....

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
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.
  • M Offline
    M Offline
    Mahesh Kulkarni
    wrote on last edited by
    #1

    Is there any way to count digits from the string? Thanks in Advance..

    The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

    D M V T 4 Replies Last reply
    0
    • M Mahesh Kulkarni

      Is there any way to count digits from the string? Thanks in Advance..

      The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

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

      Mahesh KulkarniIs there any way to count digits from the string?

      What exactly do you mean by this? Are you wanting the length of the string, or the actual count of numeric digits (0-9) within the string?


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      1 Reply Last reply
      0
      • M Mahesh Kulkarni

        Is there any way to count digits from the string? Thanks in Advance..

        The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        yes, but there is no direct way. How, in pseudocode, would you do it ? if you can do it, then translating it to C/C++ would be simple.


        Maximilien Lincourt Your Head A Splode - Strong Bad

        M 1 Reply Last reply
        0
        • M Maximilien

          yes, but there is no direct way. How, in pseudocode, would you do it ? if you can do it, then translating it to C/C++ would be simple.


          Maximilien Lincourt Your Head A Splode - Strong Bad

          M Offline
          M Offline
          Mahesh Kulkarni
          wrote on last edited by
          #4

          Maximilien wrote:

          yes, but there is no direct way.

          Yes this is right... I got the solution.. U need to check the each and every charatcter to get the total number of digits in the string. Thanks for ur HELP...

          The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

          1 Reply Last reply
          0
          • M Mahesh Kulkarni

            Is there any way to count digits from the string? Thanks in Advance..

            The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

            V Offline
            V Offline
            VonHagNDaz
            wrote on last edited by
            #5

            a simple for() loop can accomplish this by counting from variable[0] - variable[?], waiting until you find the '/0' character.

            I win because I have the most fun in life...

            1 Reply Last reply
            0
            • M Mahesh Kulkarni

              Is there any way to count digits from the string? Thanks in Advance..

              The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              use std::count_if() refer the msdn for more infos on that algorithm...


              Don't know where to start ?
              Refer the Forums Guidelines and ask a friend

              [VisualCalc 3.0][Flags Beginner's Guide]

              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