首页 > 其他 > 详细

stringstream 使用方法

时间:2015-03-05 12:38:06      阅读:286      评论:0      收藏:0      [点我收藏+]

 

C++中的stringstream是专门用来处理字符串流的,可以按顺序将string或int都拼接起来,而不用把int转换为string格式,使用方法如下:

 

#include <string>
#include <strstream>
#include <sstream>

stringstream strstream;
std::string s;
std::string s1 = "hello";
int d = 13;
strstream.str(""); strstream.clear();
strstream << s1 << "world" << d << "!"; strstream >> s;

 

stringstream 使用方法

原文:http://www.cnblogs.com/grandyang/p/4315076.html

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