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. How to parse the string

How to parse the string

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialsysadminhelp
8 Posts 6 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.
  • U Offline
    U Offline
    User 4431345
    wrote on last edited by
    #1

    Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you

    M _ CPalliniC S 5 Replies Last reply
    0
    • U User 4431345

      Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you

      M Offline
      M Offline
      Malli_S
      wrote on last edited by
      #2

      This[^] may help you !

      1 Reply Last reply
      0
      • U User 4431345

        Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you

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

        This may help you !

        enhzflepE 1 Reply Last reply
        0
        • U User 4431345

          Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          Use CString::ReverFind alongwith CString::Right or CString::Left to extract the string you want.

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          1 Reply Last reply
          0
          • U User 4431345

            Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            Search for the '/' token (plain C) strtok [^]? (ATL/MFC) CStringT::Tokenize [^]. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • M Malli_S

              This may help you !

              enhzflepE Offline
              enhzflepE Offline
              enhzflep
              wrote on last edited by
              #6

              :laugh: :laugh:

              M 1 Reply Last reply
              0
              • enhzflepE enhzflep

                :laugh: :laugh:

                M Offline
                M Offline
                Malli_S
                wrote on last edited by
                #7

                :sigh: :-\

                -Malli...! :rose:****

                1 Reply Last reply
                0
                • U User 4431345

                  Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you

                  S Offline
                  S Offline
                  Sandeep Saini SRE
                  wrote on last edited by
                  #8

                  CString str = "http://server/sharanu/inbox/test.jpg";
                  int i = str.ReverseFind('/');
                  str = str.Left(i);
                  CString sValue1 = str.Right(str.GetLength() - str.ReverseFind('/') -1);

                  i = str.ReverseFind('/');
                  str = str.Left(i);
                  CString sValue2 = str.Right(str.GetLength() - str.ReverseFind('/') -1);

                  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