当前位置:网站首页>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)
边栏推荐
- How long can we "eat" the dividends of domestic databases?
- String转为long 类型报错原因:要转为long必须是int、double、float型[通俗易懂]
- Hcip day 12
- 2022 safety officer-a certificate operation certificate examination question bank simulated examination platform operation
- 如何只降3D相机不降UI相机的分辨率
- Multi merchant mall system function disassembly lecture 17 - platform side order list
- Read the introduction tutorial of rainbow
- C# 获取当前路径7种方法
- 实时切换 Core Data 的云同步状态
- C # read INI file and key value pair operation
猜你喜欢

SSH service

8、 Picker usage drop-down box selection effect

The method of implementing simple student achievement management system with C language

35道MySQL面试必问题图解,这样也太好理解了吧
Some problems encountered in the development of Excel VBA, solutions, and continuous updates

Cv:: mat conversion to qimage error

Interviewer: what are the usage scenarios of ThreadLocal? How to avoid memory leakage?

如何只降3D相机不降UI相机的分辨率

C语言库函数getchar()怎么使用

10、 Timestamp
随机推荐
[Tanabata] Tanabata lonely little frog research edition? The final chapter of Tanabata Festival!
2022 low voltage electrician examination questions and answers
QT serialization qdatastream
How does core data save data in SQLite
为什么jq的匿名函数 外部可以访问到里面的方法
Store and guarantee rancher data based on Minio objects
9、 Uni popup usage popup effect at the bottom of the drop-down box
linux安装mysql
基于 MinIO 对象存储保障 Rancher 数据
The method of implementing simple student achievement management system with C language
[thread safety] what risks may multithreading bring?
Realization of chat room function
Force deduction solution summary 1331 array sequence number conversion
多商户商城系统功能拆解17讲-平台端订单列表
How to effectively conduct the review meeting (Part 1)?
复制excel行到指定行
Thoughts on the construction of some enterprise data platforms
How to perform batch operations in core data
Reptile: from introduction to imprisonment (I) -- Concept
linux安装redis