C++ examples for STL:iterator
Using the erase Functions with Iterator Arguments
#include <iostream> #include <string> int main(int argc, const char* argv[]) { std::string str("This is an sentence"); str.erase(str.begin() + 9);/*www . j av a2 s. c o m*/ std::cout << str << std::endl; str.erase(str.begin() + 5, str.end() - 9); std::cout << str << std::endl; return 0; }