Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Replacing a substring in a string
Replacing a substring in a string [message #479987] Tue, 19 March 2013 02:32 Go to previous message
iRANian is currently offline  iRANian
Messages: 4307
Registered: April 2011
Karma:
General (4 Stars)
I need to be able to replace a substring in a string with my own string. For example:

"Herp derpEderpD"

I'd like to replace every occurrence of "derp" with "winter", so the final string looks like:

"Herp winterEwinterD"

How would I go about doing this? I see std::string allows me to do this, but I haven't figured out how to do this with C without doing tedious and dangerous pointer arithmetic and the C libraries shitty string functions. I also couldn't find a way to do this with StringClass, but I might have missed something.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Renhelp.net
Next Topic: C&C_Carriers *wip*
Goto Forum:
  


Current Time: Sat Aug 31 23:51:27 MST 2024

Total time taken to generate the page: 0.00900 seconds