Removing character from string by his index

I have to remove a character from string and i know his position in string (index). On google i found just this way: str.erase(std::remove(str.begin(), str.end(), 'put hcaracter here')); and it removes all that characters from string. I have to remove ony one character using index. Is that posible in C++?

Example: string str = "Programming";
removing character from index 6
now it should be str = "Programing"; without an m not both of them
Take a look at the erase() functions of the string:

http://www.cplusplus.com/reference/string/string/erase/

There are three. One takes an index and a size, so:

str.erase(index, 1);

to erase that single character.
The code to remove all of a given character isn't correct. It needs to be more like:

 
    str.erase(std::remove(str.begin(), str.end(), 'm'), str.end());

Thanks i did it.
Topic archived. No new replies allowed.