C++ 字符串

字符串分词

#include<sstream>

string str = "hello world";
stringstream ss(str);
string temp;
while(ss >> temp)
{
	cout<<temp<<endl;
}

字符串截取

string str = "hello world";
cout<<str.substr(0,2)<<endl;
posted @ 2020-07-27 13:49  youqia  阅读(94)  评论(0编辑  收藏  举报