Thread: String Replace!

  1. #1
    Registered User Moni's Avatar
    Join Date
    Oct 2002
    Dhaka, Bangladesh.

    String Replace!

    writing a function:

    void StrReplace(wchar_t *OrgStr, wchar_t *RepStr)
    I've another function that returns the position of the substring I find in the original:


    int FindStr(wchar_t *OrgStr, wchar_t *Find)
    So, How can I proceed?
    We all are the components of a huge program...... the programmer is always debugging us with His debugger.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    New York
    Iterate through the orgstr, until it starts equaling find, then keep going, and if it equals until you hit the end of find, then it's found. To replace, I don't think that it could only take two parameters like that.

    Go read that thread you made in C++ again, go read about premature optimization, and re-evaluate your problem and reasoning behind doing this. If you just want experience doing it the hard way, okay, but just look at where you are now after the result of that thread. This could be made so much easier with STL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  4. Errors with program to replace string with another
    By Dan17 in forum C Programming
    Replies: 3
    Last Post: 09-14-2006, 10:15 AM
  5. Program using classes - keeps crashing
    By webren in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2005, 03:58 PM