Thread: New to C++
View Single Post
Old 10-27-2005, 05:12 PM   #15 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
Perhaps something like:
Code:
int remove_string(char* in_str, string remove_str)
{
  std::string res_str(in_str);
  int i;
  if(!strstr(in_str, remove_str.c_str()))
    return 0;
  while(string::npos != (i=res_str.find(remove_str)))
    res_str.replace(i, remove_str.length(), remove_str);
  return 1;
}
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote