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. CString Splitter?

CString Splitter?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorial
3 Posts 3 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.
  • A Offline
    A Offline
    AlexDrummer
    wrote on last edited by
    #1

    Currently inputting characters into a string varible in the CString class How can i cut a set of characters from the string into another varible? for example: - in the string is "Project" how can i extract just the "Pro" part out of it into a varible? Thanks for your help:)

    O D 2 Replies Last reply
    0
    • A AlexDrummer

      Currently inputting characters into a string varible in the CString class How can i cut a set of characters from the string into another varible? for example: - in the string is "Project" how can i extract just the "Pro" part out of it into a varible? Thanks for your help:)

      O Offline
      O Offline
      Optimus Chaos
      wrote on last edited by
      #2

      You can use the String splitting functions of CString Left, Right, Mid. For searching after certain characters you can use the Find methods. But you have to keep in mind that those are index based functions, so you have to either rely on fixed index positions or your string has to contain nearly the same content.

      1 Reply Last reply
      0
      • A AlexDrummer

        Currently inputting characters into a string varible in the CString class How can i cut a set of characters from the string into another varible? for example: - in the string is "Project" how can i extract just the "Pro" part out of it into a varible? Thanks for your help:)

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

        AlexDrummer wrote:

        for example: - in the string is "Project" how can i extract just the "Pro" part out of it into a varible?

        CString s = CString("Project").Left(3);


        "A good athlete is the result of a good and worthy opponent." - David Crow

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

        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