STL-string-member

 函数列表 函数名 描述 
begin  得到指向字符串开头的Iterator 
end  得到指向字符串结尾的Iterator 
rbegin  得到指向反向字符串开头的Iterator 
rend  得到指向反向字符串结尾的Iterator 
size  得到字符串的大小 
length  和size函数功能相同 
max_size  字符串可能的最大大小 
capacity  在不重新分配内存的情况下,字符串可能的大小 
empty  判断是否为空 
operator[]  取第几个元素,相当于数组 
c_str  取得C风格的const char* 字符串 
data  取得字符串内容地址 
operator=  赋值操作符 
reserve  预留空间 
swap  交换函数 
insert  插入字符 
append  追加字符 
push_back  追加字符 
operator+=  += 操作符 
erase  删除字符串 
clear  清空字符容器中所有内容 
resize  重新分配空间 
assign  和赋值操作符一样 

replace(size_type index, size_type len, string substr) 用子串代替从index开始的len个字符 若len==0相当于插入
replace(size_type index, size_type len, string substr, size_type index2, size_type len2)  用子串的index2开始的len2个字符替代主串中从index开始的len个字符 len==0 相当于插入 
copy  字符串到空间 
find(string substr,size_type off = 0) 从偏移量off处查找第一个substr出现的位置 
rfind  反向查找 
find_first_of (string substr, size_type off = 0 )  从偏移量off处查找包含子串中的任何字符,返回第一个位置 
find_first_not_of (string substr, size_type off = 0 )  从偏移量off处查找不包含子串中的任何字符,返回第一个位置 
find_last_of (string substr,size_type off = npos)  到off为止 查找包含子串中的任何字符,返回最后一个位置 
find_last_not_of(string substr,size_type off = npos) 到off为止 查找不包含子串中的任何字符,返回最后一个位置 
substr(size_type index,size_type len)  得到从index开始的len个字串 
compare  比较字符串 
operator+  字符串链接 
operator==  判断是否相等 
operator!=  判断是否不等于 
operator<  判断是否小于 
operator>>  从输入流中读入字符串 
operator<<  字符串写入输出流 
getline  从输入流中读入一行 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值