string类都包括什么常用函数

来源:百度知道 编辑:UC知道 时间:2024/06/18 12:05:01
就是c++里面的<string> 都包含什么功能string的函数?

std::string s1,s2;
//常用的有
s1.size();//返回字符串长度
s1=s1+s2;//字符串连接
s1=s2;//字符串赋值
if(s1==s2)//判断s1和s2是否相等
{...}
else
{...}//

cppreference.com > C++ Strings
C++ Strings
Display all entries for C++ Strings on one page, or view entries individually:

String constructors create strings from arrays of characters and other strings
String operators concatenate strings, assign strings, use strings for I/O, compare strings
append append characters and strings onto a string
assign give a string values from strings of characters and other C++ strings
at returns an element at a specific location
begin returns an iterator to the beginning of the string
c_str returns a standard C character array version of the string
capacity returns the number of elements that the string can hold
clear removes all elements from the string
compare compares two strings
copy copies characte