当前位置:网站首页>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());
边栏推荐
- Oracle modify database character set
- In depth analysis of how the JVM executes Hello World
- 微服务实战|微服务网关Zuul入门与实战
- Required request body is missing:(跨域问题)
- 分享一篇博客(水一篇博客)
- 个人经历&&博客现状
- Matplotlib剑客行——布局指南与多图实现(更新)
- Troubleshooting and handling of an online problem caused by redis zadd
- Matplotlib swordsman line - first acquaintance with Matplotlib
- How to use pyqt5 to make a sensitive word detection tool
猜你喜欢
随机推荐
概念到方法,绝了《统计学习方法》——第三章、k近邻法
自定义Redis连接池
Chrome browser tag management plug-in – onetab
Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)
MySQL multi column in operation
C语言之到底是不是太胖了
Bold prediction: it will become the core player of 5g
Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer
BugkuCTF-web24(解题思路及步骤)
Watermelon book -- Chapter 5 neural network
微服务实战|原生态实现服务的发现与调用
zk配置中心---Config Toolkit配置与使用
Attributes of classfile
Break the cocoon | one article explains what is the real cloud primordial
Knife4j 2.X版本文件上传无选择文件控件问题解决
Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
Mysql默认事务隔离级别及行锁
From concept to method, the statistical learning method -- Chapter 3, k-nearest neighbor method
自定義Redis連接池
Thinkphp5 how to determine whether a table exists