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::Replace in C++ without MFC

CString::Replace in C++ without MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
3 Posts 3 Posters 3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Can anybody either a) provide me with a C\C++ function that mimicks CString::Replace in functionality, or b) explain in detail (i.e. step by step) how to do this myself? I have tried for ages, but can;t get anything that works. :(( Thank you, Russell McCurly Hobbiest Programmer

    N A 2 Replies Last reply
    0
    • L Lost User

      Can anybody either a) provide me with a C\C++ function that mimicks CString::Replace in functionality, or b) explain in detail (i.e. step by step) how to do this myself? I have tried for ages, but can;t get anything that works. :(( Thank you, Russell McCurly Hobbiest Programmer

      N Offline
      N Offline
      Nick Blumhardt
      wrote on last edited by
      #2

      can't offer code, but have a look at std::string, from the C++ standard library.. (#include ) - it has members such as find_first_of() and replace() that you should be able to use quite easily to perform the CString::Replace() functionality. happy coding!

      1 Reply Last reply
      0
      • L Lost User

        Can anybody either a) provide me with a C\C++ function that mimicks CString::Replace in functionality, or b) explain in detail (i.e. step by step) how to do this myself? I have tried for ages, but can;t get anything that works. :(( Thank you, Russell McCurly Hobbiest Programmer

        A Offline
        A Offline
        Alvaro Mendez
        wrote on last edited by
        #3

        It's not a trivial task because the text being replaced may be larger or smaller (in length) than the text to replace it with. I recommend looking at CString::Replace's source code to get some ideas. Even better, use the debugger to step into the function to see it in action. If you want, you may also post your source code and we'll try to spot the problems. Regards, Alvaro

        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