当前位置:网站首页>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());
边栏推荐
- C语言之分草莓
- 每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
- 记录下对游戏主机配置的个人理解与心得
- MySQL事务
- Operation and application of stack and queue
- Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
- Elastic Stack之Beats(Filebeat、Metricbeat)、Kibana、Logstash教程
- Flink - use the streaming batch API to count the number of words
- Demand delineation executive summary
- [go practical basis] how to set the route in gin
猜你喜欢
A detailed explanation takes you to reproduce the statistical learning method again -- Chapter 2, perceptron model
微服务实战|负载均衡组件及源码分析
记录一下初次使用Xray的有趣过程
Say goodbye to 996. What are the necessary plug-ins in idea?
数构(C语言)——第四章、矩阵的压缩存储(下)
Complete solution of servlet: inheritance relationship, life cycle, container, request forwarding and redirection, etc
一次聊天勾起的回忆
Pool de connexion redis personnalisé
hystrix 实现请求合并
知识点很细(代码有注释)数构(C语言)——第三章、栈和队列
随机推荐
Jd.com interviewer asked: what is the difference between using on or where in the left join association table and conditions
每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
BugkuCTF-web16(备份是个好习惯)
BugkuCTF-web21(详细解题思路及步骤)
每天睡前30分钟阅读Day5_Map中全部Key值,全部Value值获取方式
双非本科生进大厂,而我还在底层默默地爬树(上)
The channel cannot be viewed when the queue manager is running
分享一篇博客(水一篇博客)
idea查看字节码配置
概念到方法,绝了《统计学习方法》——第三章、k近邻法
Chrome用户脚本管理器-Tampermonkey 油猴
Hystrix implements request consolidation
Chrome浏览器插件-Fatkun安装和介绍
Elastic Stack之Beats(Filebeat、Metricbeat)、Kibana、Logstash教程
Knife4j 2.X版本文件上传无选择文件控件问题解决
定时线程池实现请求合并
告别996,IDEA中必装插件有哪些?
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
每天睡觉前30分钟阅读_day4_Files
What are the differences between TP5 and laravel