(转)stringstream类的使用(实现string类型与其余类型的转化)
2011-04-24 16:54
363 查看
转自论坛帖子 http://topic.csdn.net/u/20100412/16/2a9a0c15-63e7-4bd5-8019-6c3959540adf.html
C/C++ code #include <iostream> #include <string> #include<sstream> using namespace std; int main() { string s="123"; stringstream st; int a; st<<s; st>>a; cout<<a<<endl; system("pause"); return 0; }
相关文章推荐
- (转)stringstream类的使用(实现string类型与其余类型的转化)
- JavaScript的String类型replace()方法介绍和使用replace()方法实现简单html模板替换功能
- 使用泛型实现类型转化-使用通配符上限下限区分协变和逆变采取不同的转化方式
- 在c++Builder中使用boost正则表达式实现的查找double和int类型的字符串,并实现StringToInteger和StringToDouble函数
- istringstream, ostringstream, stringstream 实现数据类型转化为 string
- 用C语言实现将int类型转化为字符串,不使用已有的转换函数
- 关于switch语句中使用String类型的实现原理
- C++类中包含string类型数据使用read和write实现文件读取和输出时遇到的问题
- 关于switch语句中使用String类型的实现原理
- c++实现一个比较两个string类型的版本号的小demo
- Unity IOC容器通过配置实现类型映射的几种基本使用方法
- 使用JSON.parse(),JSON.stringify()实现对对象的深拷贝
- python使用.map() 实现首字母大写,其余小写
- 将HTML格式的String转化为HTMLElement的实现方法
- SpannableString中的LinkMovementMethod和ClickableSpan的实现安卓可点击有颜色文字使用
- 在jdk 1.6版本中,switch的参数无法使用String类型
- SQL中CONVERT(转化日期类型、格式化日期)函数使用
- String与int类型相互转化
- String类型转化为map类型
- Flex中Date类型与String类型相互转化