
STL函数
不停---
吹皱一池春水
buting.site
展开
-
string类部分常用函数
1.string append(const char *s) //将字符串s追加到本字符串末尾 2.string assign(const char *s) //将字符串s赋值给本字符串 3.int compare(const string& str)const; //该函数作用是比较两个字符串是否相同 4.string& insert(unsigned int p0,const ...原创 2019-04-21 22:26:41 · 211 阅读 · 0 评论 -
Cpp小知识点 (5) cpp笔记
string类函数追加 string s1{"hello world"); s1.append("welcome",3,2);//从第三个位置开始后的两个位置。 s1.append("welcome",5);//从开头起始; s1.append(4,'g');//将字符重复多少遍; at(index)//返回当前字符串中index位置的字符; clear();//清空字符串 erase(index...原创 2019-04-22 20:44:51 · 150 阅读 · 0 评论 -
CPP小知识点(6) 数组类
数组类 c++数组是一个模板类,可以适应任何类型的数据; #include<array> std::array<int,10>name; std::array<数组类型,数组大小>数组名字; //二维数组 std::array<array<int,10>,3>name; ...原创 2019-04-22 21:21:00 · 316 阅读 · 0 评论 -
C++ STLcontainer vector erase函数
erase函数:(摘自 c++ reference) Erase elements Removes from the vector either a single element (position) or a range of elements ([first,last)). This effectively reduces the container size by the number of...原创 2019-09-08 15:54:13 · 135 阅读 · 0 评论