string replace question

I am trying to create a filename based on a window title.

I can get the window title with:

std::string filename = w_title;

but the window title will always have (in different positions) these symbols in it - ":", ",", "$"

I want to change the colon to a ".", the "/" to a "-", and the $ to "" so that I end up with a valid filename, otherwise the file never gets created.

I have tried looking a various exmples of str.replace but have not been successful.

Any ideas?

Thanks.
loop through the string and change any char if necessary.
like this:
1
2
3
for(int i=0; i<str.lenght(); i++){
   if(str[i]=='.')  str[i] = ' ';
}

simple!
Topic archived. No new replies allowed.