Replacing a substring in a string [message #479987] |
Tue, 19 March 2013 02:32 ![Go to next message Go to previous message](/theme/Renegade_Forums/images/down.png) |
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
|
|
|