basic_string (const basic_string& str);
from c-string (4) basic_string (const charT* s, const allocator_type& alloc = allocator_type());
basic_string (const charT* s, size_type n, const allocator_type& alloc = allocator_type());
basic_string (size_type n, charT c,const allocator_type& alloc = allocator_type());
basic_string (const basic_string& str, size_type pos, size_type len = npos,const allocator_type& alloc = allocator_type());
template <class InputIterator> basic_string (InputIterator first, InputIterator last,const allocator_type& alloc = locator_type());
string str("12345", 10);
string str1(str, 3);
string str4("12322435", 3);
string str2(str, 3, 3);
string str3(str,3,str.length());
str.begin()
str.size()
str.length()
str.empty()
str.max_size()
str.capacity()
str.resize(100,'a')
str.length()
string str("123456");
std::size_t pos=str.find('1');
str.find("45");
str.find("12",4);
str.find("12348888",0,4);
str.rfind()
string str("12345678");
std::size_t pos=str.find_first_of(‘8’);
str.find_first_not_of('8');
str.find_first_not_of("123456");
" sdfsgsgsrg 132456789 rwergresg"
std::size_t pos_begin = str.find_first_of("1234567890");
pos_end = str.find_first_not_of("123456789",pos);
string strNum(str.begin()+pos_begin,str.begin()+pos_end);
str.compare()
str.compare(str);
str.compare(pos_begin,pos_end-pos_begin,strNum);
str.substr(begin,end-begin);
str.swap(str);
str+=
str.append();
str.append(10,'m');
str.assign();
str.at();
try
{
std::cout<<str.at(100);
}
catch (std::out_of_range ex)
{
}
str.insert();
str.erase(pos,npos);
str.c_str();//c风格字符串带\0
str.data();//返回data指针(const char*),没有\0