首页 > 编程语言 > 详细

C++ 字符串

时间:2020-07-27 16:46:08      阅读:55      评论:0      收藏:0      [点我收藏+]

字符串分词

#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;

C++ 字符串

原文:https://www.cnblogs.com/alilliam/p/13385031.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!