_value, size_type_index, size_type_count)
s.append(first_input_iterator, last_input_iterator)
//
operator=
s.assign(string_value)
s.assign(c_string_value)
s.assign(size_type_count, char_value)
s.assign(c_string_value, size_type_count)
s.assign(c_string_value, size_type_index, size_type_count)
s.assign(start_input_iterator, end_input_iterator)
转换为c-string
s.copy(char_array, size_type_count, size_type_index)
s.c_str() //返回以结束的char数组地址,数组归s所有,不要更改
s.data() //返回不以结束的char数组地址,数组归s所有,不要更改
子串
s.substr(size_type_index)
s.substr(size_type_index, size_type_count)
容量及调整容量
s.empty()
s.capacity()
s.length()
s.size()
s.max_size()
s.reserve(size_type_value)
s.resize(size_type_value, char_value)
s.resize(size_type_value)
删除
s.clear()
s.erase() //删除所有字符
s.erase(size_type_index)
s.erase(size_type_index, size_type_count)
s.erase(iterator_position)
s.erase(first_iterator, last_iterator)
查找
//所有的find均返回下标值,若找不到,返回string::npos
//
//查找char
s.find(char_value)
s.find(char_value, size_type_index)
s.rfind(char_value)
s.rfind(char_value, size_type_index)
//
//查找string
s.find(string_value)
s.find(string_value, size_type_index) //从index处开始查找
//从后向前查找
s.rfind(string_value)
s.rfind(string_value, size_type_index)
//查找cstring
s.find(c_string_value, size_type_index, size_type_count)
s.rfind(c_string_value, size_type_index, size_type_count)
//
s.find_first_of(char_value)
s.find_first_of(char_value, size_type_index)
s.find_first_not_of(char_value)
s.find_first_not_of(char_value, size_type_index)
//
//查找在/不在string中的char,返回下标
s.find_first_of(string_value)
s.find_first_of(string_value, size_type_index)
s.find_first_not_of(string_value)
s.find_first_not_of(string_value, size_type_index)
//
s.find_first_of(c_string_value, size_type_index, size_type_count)
s.find_first_not_of(string_value, size_type_index, size_type_count)
//
s.find_last_of(char_value)
s.find_last_of(char_value, size_type_index)
s.find_last_not_of(char_value)
s.find_last_not_of(char_value, size_type_index)
//
s.find_last_of(string_value)
s.find_last_of(string_value, size_type_index)
s.find_last_not_of(string_value)
s.find_last_not_of(string_value, size_type_index)
//
s.find_last_of(c_string_value, size_type_index, size_type_count)
s.find_last_not_of(string_value, size_type_index, size_type_count)
插入值
s.insert(size_type_index, string_variable)
s.insert(size_type_index, c_string_value)
s.insert(size_type_index1, string_variable, size_type_index2, size_type_count)
s.insert(size_type_index, c_string_value, size_type_count)
s.insert(size_type_index, size_type_count, char_value)//c++中函数形参总是count在val之前
s.insert(iterator_position, size_type_count, char_value)
s.insert(iterator_position, char_value)
s.insert(iterator_position, input_iterator_first, input_iterator_last)
//
s.push_back(char_value)
字符/字符串替换
s.replace(size_type_index, size_type_count, string_value)
s.replace(iterator_first, iterator_last, string_value
s.replace(size_type_index1, size_type_count1, string_value,
size_type_index2, size_type_count2)