当前位置:网站首页>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)
边栏推荐
猜你喜欢

It's so hot that solar power can't take off? Hello, head

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

爆肝整理JVM十大模块知识点总结,不信你还不懂

Redis redis use in jedis

数字化转型安全问题频发,山石网科助力数字政府建设

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

2022 high altitude installation, maintenance, removal of examination question bank and online simulated examination

Many "double first-class" universities have launched the research guarantee and prediction name!

Redis-配置文件讲解

Redis configuration file explanation
随机推荐
The method of implementing simple student achievement management system with C language
Chi square distribution and gamma function
[线程安全问题] 多线程到底可能会带来哪些风险?
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
SwiftUI 布局 —— 尺寸( 下 )
Product Manager
Creating, deleting and viewing Anaconda virtual environment
为什么jq的匿名函数 外部可以访问到里面的方法
OKR and grad
Create a table under swiftui with table
JS instantiation method
Why is it reverse to convert from other formats to BMP
linux安装redis
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
When Xcode writes swiftui code, it is a small trap that compiles successfully but causes the preview to crash
Qtableview in QT sets three methods of paging display [easy to understand]
Qt中QTableView设置分页显示的三种方法[通俗易懂]
Reptile: from introduction to imprisonment (I) -- Concept
Ability to add class @published for custom attribute wrapper types
&0xffffffff(0x08)