当前位置:网站首页>QT hex, decimal, qbytearray, qstring data conversion
QT hex, decimal, qbytearray, qstring data conversion
2022-07-28 14:53:00 【Love the west wind】
One 、QT QString Each character changes Plastic figure
First of all, it is not clear whether there is a better way , I write here a kind of ;
QString textStr = "54326";
// first to QByteArray
QByteArray strArray = textStr.toLatin1();
int arraySize = strArray.size();
for(int i =0;i<arraySize;i++)
{
// get ASCII ;sub '0'
int value = strArray[i]-48;
qDebug()<< QString::number(value) <<" ";
}print out:
"5"
"4"
"3"
"2"
"6"
Two 、QString And int transformation
QString qstr = QString::number(123);
int i = atoi(qstr.toStdString().c_str());
You can do that :int i = atoi(qstr.ascii());
3、 ... and 、QString And string, namely std::string
string s = qstr.toStdString();
QString qstr2 = QString::fromStdString(s)
边栏推荐
- 2022 safety officer-a certificate operation certificate examination question bank simulated examination platform operation
- Installing redis in Linux
- 在 SwiftUI 视图中打开 URL 的若干方法
- Many "double first-class" universities have launched the research guarantee and prediction name!
- RPC (remote procedure call protocol) telecommunication framework
- [thread safety] what risks may multithreading bring?
- SwiftUI 的动画机制
- Redis-持久化
- Reptile: from introduction to imprisonment (I) -- Concept
- 为 @CloudStorage 添加了类 @Published 的能力
猜你喜欢

Redis persistence

SSH service

Getting started with scottplot tutorial: getting and displaying values at the mouse

树莓派基础 | 总结记录树莓派学习过程中的一些操作
![[线程安全问题] 多线程到底可能会带来哪些风险?](/img/79/112ab7e586b0bceb296dfddb2728be.png)
[线程安全问题] 多线程到底可能会带来哪些风险?

九、uni-popup用法 下拉框底部弹窗效果

TDengine 助力西门子轻量级数字化解决方案

2022 low voltage electrician examination questions and answers

OKR and grad

Multi merchant mall system function disassembly lecture 17 - platform side order list
随机推荐
The second pre class exercise
SwiftUI 4.0 的全新导航系统
Chi square distribution and gamma function
Animation mechanism of swiftui
为什么jq的匿名函数 外部可以访问到里面的方法
pix2pix
I am using a blog creation tool
Hand in hand from 0 to a "Nuggets special attention" Google plug-in, 5000 words detailed vue3 responsive principle, the advantages, disadvantages and choices of several cache read-write schemes, flyin
Multi merchant mall system function disassembly lecture 17 - platform side order list
如何让照片中的人物笑起来?HMS Core视频编辑服务一键微笑功能,让人物笑容更自然
九、uni-popup用法 下拉框底部弹窗效果
Factory mode and constructor mode
Swiftui 4.0's new navigation system
Node file operation
ScottPlot入门教程:获取和显示鼠标处的数值
BGP experiment
QT qbuttongroup realizes single selection and multiple selection
Why is it reverse to convert from other formats to BMP
Redis-配置文件讲解
How many ways can multithread run in sequence?