?????????????? 1、find(c, off) 在 s [off, npos) 中查找 c??
?????????????? 2、find(p, off, n) 在 s [off, npos) 中查找 [p, p + n)??
?????????????? 3、find(p, off) 在 s [off, npos) 中查找 [p, <null>)??
?????????????? 4、find(s2, off) 在 s [off, npos) 中查找 s2??
2)find() 的变种??
?????????????? 1、rfind() 具有 find() 的输入形式,反序查找??
?????????????? 2、find_first_of() 具有 find() 的输入形式,返回第一个匹配的索引??
?????????????? 3、find_last_of() 具有 find() 的输入形式,返回倒数第一个匹配的索引??
?????????????? 4、find_first_not_of() 具有 find() 的输入形式,返回第一个不匹配的索引??
?????????????? 5、find_last_not_of() 具有 find() 的输入形式,返回倒数第一个不匹配的索引??
3)replace() 替换??
?????????????? 1、replace(off, cnt, s2) 将 s [off, off + cnt) 替换成 s2??
?????????????? 2、replace(off, cnt, s2, off2, cnt2) 将 s [off, off + cnt) 替换成 s2 [off2, off2 + cnt2)
?????????????? 3、replace(off, cnt, p) 将 s [off, off + cnt) 替换成 [p, <null>)??
?????????????? 4、replace(off, cnt, p, cnt2) 将 s [off, off + cnt) 替换成 [p, p + cnt2)
?????????????? 5、replace(off, cnt, n, c) 将 s [off, off + cnt) 替换成 c * n??
使用迭代器的情况:??
?????????????? 6、replace(InF, InL, s2) 将 [InF, InL) 替换成 s2??
?????????????? 7、replace(InF, InL, p) 将 [InF, InL) 替换成 [p, <null>)??
?????????????? 8、replace(InF, InL, p, cnt) 将 [InF, InL) 替换成 [p, p + cnt)??
?????????????? 9、replace(InF, InL, n, c) 将 [InF, InL) 替换成 n * c??
?????????????? 10、replace(InF, InL, InF2, InL2) 将 [InF, InL) 替换成 [InF2, InL2)??
4)erase() 删除??
?????????????? 1、erase(off, cnt) 从字符串 s 中删除 s [off, off + cnt)??
?????????????? 2、erase(iter) 从字符串 s 中删除 *iter??
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-74348-9.html
为其利益服务