Original Post
* im working with chars, no..do not mention STL..that is out of the question, because i am trying to get more experienced with chars, basically this is a learning experience. *
anyway, i''m trying to make a replace function for a string..i can easily do one that replaces one character, like...
that pretty much works, but i want to be able to replace a STRING of letters, like
void s_replace(char *string, char *find, char *replace) {
}
so that i can replace "bob" with "robert" if i wanted to..
but i im not sure how to approach this..help?
void s_replace(char *string, char find, char replace) {
//blah blah blah
if (string[i] == find) {
string[i] = replace;
}
}
|