当前位置:网站首页>关于std::vector<std::string>的操作
关于std::vector<std::string>的操作
2022-08-04 21:40:00 【android framework】
知识点
1 std::vectorstd::string 作为返回参数
void GetConfigState(std::vectorstd::string&vtTemp)
2 对于std::vectorstd::string取值操作
std::vectorstd::string::iterator theIterator;
for( theIterator = vtTemp.begin(); theIterator != vtTemp.end(); theIterator++ )
cout<c_str()<<endl;//这样取值
3 不能直接进行容器间赋值
#include
#include
using namespace std;
void GetConfigState(std::vectorstd::string&vtTemp)
{
unsigned int nLen = 0;
unsigned int nValue = 0;
std::string strType_Item;
std::string strType_Items;
std::string strTemp =“AT+CFUN=1;AT+CFUN=0”;
int nPos = strTemp.find(“;”,0);
int j = 0;
while (nPos != -1)
{
vtTemp.push_back(strTemp.substr(0,nPos));
nPos ++;
strTemp = strTemp.substr(nPos,strTemp.length() - nPos);
nPos = strTemp.find(“,”,0);
j++;
}
if (strTemp.length() != 0)
{
vtTemp.push_back(strTemp.c_str());
}
}
int main()
{
std::vector<std::string> vtTemp;
std::vector<std::string>::iterator theIterator;
GetConfigState(vtTemp);
for( theIterator = vtTemp.begin(); theIterator != vtTemp.end(); theIterator++ )
cout<<theIterator->c_str()<<endl;
getchar();
return 0;
}
边栏推荐
- Webmine Webpage Mining Trojan Analysis and Disposal
- win10 uwp use WinDbg to debug
- CPU、内存、显卡等硬件因素也影响着你的深度学习模型性能
- SPSS-System Clustering Hand Calculation Practice
- 1.读写点云文件
- PRIMAL: Pathfinding via Reinforcement and Imitation Multi-Agent Learning 代码解析
- Go----Go 语言基础之标识符、关键字、命名规范、变量、常量
- Cocoa Application-test
- 大势所趋之下的nft拍卖,未来艺术品的新赋能
- Moke, dynamic image resource package display
猜你喜欢
随机推荐
Red team kill-free development practice of simulated confrontation
[Linear Algebra 02] 2 interpretations of AX=b and 5 perspectives of matrix multiplication
PowerCLi import license to vCenter 7
数电快速入门(一)(BCD码和三种基本逻辑运算的介绍)
如何一键重装Win11系统 一键重装系统方法
OC-协议
ctfshow终极考核web654
LayaBox---TypeScript---Example
AXI interface application of Zynq Fpga image processing - the use of axi_lite interface
数电快速入门(四)(组合逻辑电路的分析以及设计的介绍)
laravel whereDoesntHave
buu web
知识分享|如何设计有效的帮助中心,不妨来看看以下几点
OC-拷贝
27.降维
Altium Designer 19.1.18 - Protecting Locked Objects
多个平台显示IP属地,必须大力推行互联网实名制
Driving point cloud format changes bring efficiency improvement
2022年江苏省大学生电子设计竞赛(TI杯)B题 飞机 省级一等奖记录 “一个摆烂人的独白”
打卡第 2 天: urllib简记