std::string::erase

// 移除从 index 开始的 std::min(count, size() - index) 个字符。
basic_string& erase( size_type index = 0, size_type count = npos );
 
// 移除位于 position 的字符。
iterator erase( const_iterator position );
 
// 移除范围 [first, last) 中的字符。
iterator erase( const_iterator first, const_iterator last );

std::string::insert

// 在位置 index 插入 count 个字符 ch 的副本。
basic_string& insert( size_type index, size_type count, CharT ch );
 
// 在位置 index 插入 s 所指向的空终止字符串。字符串的长度由首个空字符,通过 Traits::length(s) 确定。
basic_string& insert( size_type index, const CharT* s );
 
// 在位置 index 插入范围 [s, s+count) 中的字符。范围能含有空字符。
basic_string& insert( size_type index, const CharT* s, size_type count );
 
// 在位置 index 插入字符串 str。
basic_string& insert( size_type index, const basic_string& str );
 
// 在位置 index 插入由 str.substr(index_str, count) 获得的字符串。
basic_string& insert( size_type index, const basic_string& str, size_type index_str, size_type count );
basic_string& insert( size_type index, const basic_string& str, size_type index_str, size_type count = npos);
 
// 在 pos 所指向的字符前插入字符 ch。
iterator insert( iterator pos, CharT ch );
iterator insert( const_iterator pos, CharT ch );
 
// 在 pos 所指向的元素(如果存在)前插入 count 个字符 ch 的副本。
void insert( iterator pos, size_type count, CharT ch );
iterator insert( const_iterator pos, size_type count, CharT ch );