当前位置:网站首页>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)
边栏推荐
- Factory mode and constructor mode
- 58 sub station Anju, broker marketing management platform login interface encryption reverse
- Another way of understanding the essence of Hamming code
- Swiftui 4.0's new navigation system
- Redis-配置文件讲解
- unittest执行runTestCase提示<_io.TextIOWrapper name=‘<stderr>‘ mode=‘w‘ encoding=‘utf-8‘>解决方案
- Swiftui layout - size (bottom)
- How to use the C language library function getchar ()
- @Solution to DS ('slave') multi data source compatible transaction problem
- Namespace conflict problem
猜你喜欢

2022 low voltage electrician examination questions and answers

Digital transformation security issues occur frequently, and Shanshi Netcom helps build a digital government

Penguin side: why not recommend using select *?

Bulk Rename Utility

SSH service

Thoughts on the construction of some enterprise data platforms

2022 safety officer-a certificate operation certificate examination question bank simulated examination platform operation
C # 7 methods to obtain the current path

58 sub station Anju, broker marketing management platform login interface encryption reverse

2022 melting welding and thermal cutting examination questions and online simulation examination
随机推荐
Node file operation
Many "double first-class" universities have launched the research guarantee and prediction name!
SwiftUI 布局 —— 尺寸( 上 )
Why is it reverse to convert from other formats to BMP
Redis-Redis在Jedis中的使用
Several methods of opening URL in swiftui view
1st pre class exercise
It's so hot that solar power can't take off? Hello, head
围绕新市民金融聚焦差异化产品设计、智能技术提效及素养教育
[thread safety] what risks may multithreading bring?
linux安装mysql
How to use the C language library function getchar ()
2022 melting welding and thermal cutting examination questions and online simulation examination
Some problems encountered in the development of Excel VBA, solutions, and continuous updates
C language related programming exercises
如何让照片中的人物笑起来?HMS Core视频编辑服务一键微笑功能,让人物笑容更自然
Factory mode and constructor mode
Log management platform of infrastructure and nail & email alarm notification
The third pre class exercise
The method of implementing simple student achievement management system with C language