字符串string和STL总结
设string s
查找函数
1.a=s.find("me",a); 以下标a开头查找字符串me 找到了就返回下标到a找不到a就是-1
2.a=s.find(0,2,‘3’); 在0到1内查找字符3 找到了就返回下标到a找不到a就是-1
比较函数compare
s.compare(s.length()-4,3,"ong",0,3) 以s.length()开头长度为3开始查找ong中0到2的区间 如果相同返回0
替换函数
s.replace(0,2,"!"); 0到1的字符串替换为!
s.substr(a,b) 取a到b-1闭区间的字符串
STL迭代
for(auto : xxx)、
map查找:
who.find(a)==who.end()
浙公网安备 33010602011771号