当前位置:网站首页>int与string、int与QString互转
int与string、int与QString互转
2022-07-02 06:34:00 【懵懂的梦花火】
1 int转string
1.1 流的 << 运算符
// 流的 << 运算符
int a = 10;
stringstream ss;
ss << a;
string str = ss.str();
1.2 c++11 std::to_string
int a = 10;
std::string s = std::to_string(a);
2 string 转 int
2.1 std::atoi
string _str = pSaveConfigElement->FirstChildElement("SaveVideoWidth")->GetText();
int mVideoWidth = std::atoi(_str);
3 int转QString
3.1.直接调用QString::number()
int number = 10;
QString str = QString::number(number );
4 QString 转 int
QString str = “10”;
int number = str.toInt();
5 QString转string
QString str = “10”;
string stdStr= str.toStdString();
6 string转QString
std::string _stdStr = "sfd";
QString _qStr(_stdStr.c_str());
边栏推荐
- Programmers with ten years of development experience tell you, what core competitiveness do you lack?
- C语言之二进制与十进制
- 自定义Redis连接池
- 机器学习实战:《美人鱼》属于爱情片还是动作片?KNN揭晓答案
- Number structure (C language -- code with comments) -- Chapter 2, linear table (updated version)
- 每天睡前30分钟阅读Day5_Map中全部Key值,全部Value值获取方式
- Knife4j 2.X版本文件上传无选择文件控件问题解决
- Matplotlib剑客行——布局指南与多图实现(更新)
- Knowledge points are very detailed (code is annotated) number structure (C language) -- Chapter 3, stack and queue
- Double non undergraduate students enter the factory, while I am still quietly climbing trees at the bottom (Part 1)
猜你喜欢

微服务实战|手把手教你开发负载均衡组件

自定義Redis連接池

Number structure (C language -- code with comments) -- Chapter 2, linear table (updated version)

Chrome视频下载插件–Video Downloader for Chrome

BugkuCTF-web21(详细解题思路及步骤)

Mysql 多列IN操作

Matplotlib swordsman line - first acquaintance with Matplotlib

idea查看字节码配置

数构(C语言--代码有注释)——第二章、线性表(更新版)

概率还不会的快看过来《统计学习方法》——第四章、朴素贝叶斯法
随机推荐
Knife4j 2.X版本文件上传无选择文件控件问题解决
Customize redis connection pool
自定义Redis连接池
Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)
Oracle modifies tablespace names and data files
Typora安装包分享
个人经历&&博客现状
每天睡前30分钟阅读Day5_Map中全部Key值,全部Value值获取方式
Knowledge points are very detailed (code is annotated) number structure (C language) -- Chapter 3, stack and queue
How to use PHP spoole to implement millisecond scheduled tasks
西瓜书--第六章.支持向量机(SVM)
VIM operation command Encyclopedia
一篇详解带你再次重现《统计学习方法》——第二章、感知机模型
MySql报错:unblock with mysqladmin flush-hosts
BugkuCTF-web21(详细解题思路及步骤)
定时线程池实现请求合并
图像识别-数据标注
Required request body is missing:(跨域问题)
Creation and jump of activity
西瓜书--第五章.神经网络