string和wstring
容器
allocate //分配器
iterator //访回string的迭代器
const_iterator //访回string的常量迭代器
pointer //指向T(char)的指针
const_pointer //指向T(char)的常量指针
const_reference //T(char)的常量引用
reference //T(char)的引用
const_reverse_iterator //访回string的方向常量迭代器
reverse_iterator //访回string的方向迭代器
difference_type //int类型
size_type unsigned int类型
traits_type
value_type //对象类型T(char)
字符串操作
const char &operator[](int n)const;
const char &at(int n)const; //返回当前字符串中第n个字符的位置,越界会抛出out_of_range异常
const char *data()const; //返回一个非null终止的c字符数组,其大小为size()的返回值,
const char *c_str()const; //返回以null终止的c风格字符串
int copy(char *s, int n, int pos = 0) const; //把当前串中以pos开始的n个字符拷贝到s字符数组中,返回实际拷贝的数目
string& assign(const char *s); //用新字符串填充,等同operator=
string& append(const char *s); //把s连接到当前字符串结尾
clear() //清空字符串
string& replace(size_type p,size_type n,const char *s);//删除从p开始的n个字符,然后在p处插入s
string& insert(size_type p,const char *s); //在位置p插入s
iterator erase(iterator first, iterator last); //删除[first,last)之间的所有字符,
substr(pos) const; //返回pos开始的n个字符组成的字符串
void swap(string& str); //交换当前字符串与str的值
特性
size_type capacity() const; //返回容量即不必增加内存即可存放的元素个数
void reserve(size_type n); //强制修改容量为n
size_type max_size() const; //返回string对象中可存放的最大字符串长度,不是capacity()的大小
size_type size() const; //返回当前字符串的大小
size_type length() const; //返回当前字符串的长度,跟size()相识。
void resize(size_type n, char c = char()); //把字符串当前大小置为n,并用字符c填充不足的部分
bool empty() const; //当前字符串是否为空与size()效率相同
字符串比较
int compare(const string& str) const; //比较字符串大小。小于str返回-1;相等返回0;
查找
size_type find(char c,size_type pos = 0) const; //从pos开始查找c的位置。失败返回string::npos
size_type find_first_of(char c,size_type pos = 0) const; //从pos开始查找字符c第一次出现的位置。失败返回string::npos。
size_type find_first_not_of(char c,size_type pos = 0)const;//从pos开始查找c不在当前字符串第一次出现的位置。失败返回string::npos。
size_type rfind(char c,size_type pos = npos) const;//从当前字符串pos开始从后向前查找。默