loopforever
09-11-2002, 08:43 PM
Hey all,
I'm just getting into c++, and I've run into a problem in a script I'm writing. I need to replace all instances of a substring within a larger string.
For example, if I have a string like this:
"The silly chicken went to chicken school."
And the substring I need to remove is "chicken", how can I end up with a result like this:
"The silly went to school."?
The var.replace function doesn't seem to allow me to replace all instances of "chicken" for "" (nothing) because it requires a start and end point.
Any help is greatly appreciated! Thanks for your time!
I'm just getting into c++, and I've run into a problem in a script I'm writing. I need to replace all instances of a substring within a larger string.
For example, if I have a string like this:
"The silly chicken went to chicken school."
And the substring I need to remove is "chicken", how can I end up with a result like this:
"The silly went to school."?
The var.replace function doesn't seem to allow me to replace all instances of "chicken" for "" (nothing) because it requires a start and end point.
Any help is greatly appreciated! Thanks for your time!
