当前位置:网站首页>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());
边栏推荐
- Number structure (C language -- code with comments) -- Chapter 2, linear table (updated version)
- Elastic Stack之Beats(Filebeat、Metricbeat)、Kibana、Logstash教程
- Timed thread pool implements request merging
- 微服务实战|微服务网关Zuul入门与实战
- C语言之判断直角三角形
- FragmentTabHost实现房贷计算器界面
- College Students' CET-4 and CET-6 composition template (self created version, successfully crossed CET-6)
- [go practical basis] gin efficient artifact, how to bind parameters to structures
- Chrome video download Plug-in – video downloader for Chrome
- Operation and application of stack and queue
猜你喜欢

Operation and application of stack and queue

JDBC回顾

Hystrix implements request consolidation

Complete solution of servlet: inheritance relationship, life cycle, container, request forwarding and redirection, etc

Ora-12514 problem solving method

Microservice practice | teach you to develop load balancing components hand in hand

自定义Redis连接池

破茧|一文说透什么是真正的云原生

图像识别-数据标注

BugkuCTF-web21(详细解题思路及步骤)
随机推荐
c语言编程题
BugkuCTF-web24(解题思路及步骤)
The channel cannot be viewed when the queue manager is running
Long summary (code with comments) number structure (C language) -- Chapter 4, string (Part 1)
Attributes of classfile
[go practical basis] how to set the route in gin
What is the function of laravel facade
Idea view bytecode configuration
分享一篇博客(水一篇博客)
Creation and jump of activity
Ora-12514 problem solving method
记录下对游戏主机配置的个人理解与心得
Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer
DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
上班第一天的报错(Nessus安装winpcap报错)
How to choose between efficiency and correctness of these three implementation methods of distributed locks?
西瓜书--第五章.神经网络
上班第一天的报错(AWVS卸载不彻底)
Discussion on improving development quality and reducing test bug rate
Watermelon book -- Chapter 5 neural network