当前位置:网站首页>QT char to qstring hexadecimal and char to hexadecimal integer
QT char to qstring hexadecimal and char to hexadecimal integer
2022-07-24 06:00:00 【Joey Boye o (* ^ ^ ^ *) o】
List of articles
Qt Character conversion
Qt char Type conversion QString type 16 Base and char type turn 16 Decimal integer
Remove the characters Qstring Unwanted characters in string
The code is as follows ( Example ):
void Widget::parseData(QString &str1)
{
char array[]={
'f',':'}; // Characters to be removed f、:、
int length = sizeof (array)/sizeof (char);
for(int i=0;i<length;i++)
{
QString tmp = QString(array[i]);
if(str1.contains(tmp))
{
str1 =str1.replace(tmp,"");
}
}
}
char turn Qstring 16 Base number
The code is as follows ( Example ):
QString Widget::Byte_16(uchar *Data,int iLength) // Input uchar type character string , return QString type 16 Base number character string .
{
QString ST="",strT;
int iB,iS;
char cB,cS;
//---
for (int i=0;i<iLength;i++)
{
iB = *(Data+i)/16;
if (iB>=10)
{
cB = 'A' + (iB-10);
}
else
cB = '0' + iB;
iS = *(Data+i)%16;
if (iS >= 10)
{
cS = 'A' + (iS-10);
}
else
cS = '0' + iS;
strT=QString("%1%2 ").arg(cB).arg(cS);
ST += strT;
}
return ST;
}
QlineEdit obtain QString String rotation 16 Binary integer
The code is as follows ( Example ):
QString g_str =g_edit_4->text();
bool ok;
int length = g_str.size()/3+1; // String division 3 Length of bytes after , Get three at a time
uchar array[length];
for(int i = 0; i<=length; i++)
{
array[i] = (uchar) g_str.mid(i*3,2).toUInt(&ok,16); //mid Every three Get two
}
char *p = (char *)array; // Use a pointer to point to an integer , So as to achieve use char type Output integer 16 Base number
g_sender->writeDatagram(p,QHostAddress(g_ip),g_port);
边栏推荐
- 使用Qt连接MySql并创建表号、写入数据、删除数据
- Two architectures of data integration: ELT and ETL
- JSON. Dumps() function parsing
- Learning rate optimization strategy
- MySql与Qt连接、将数据输出到QT的窗口tableWidget详细过程。
- [FatFs] migrate FatFs manually and transfer SRAM virtual USB flash disk
- Machine learning (zhouzhihua) Chapter 1 Introduction notes learning experience
- 找ArrayList<ArrayList<Double>>中出现次数最多的ArrayList<Double>
- DeepSort 总结
- [activiti] group task
猜你喜欢

A small problem in labelme to VOC code

JUC并发编程基础(8)--读写锁

第四章 决策树总结

"Statistical learning methods (2nd Edition)" Li Hang Chapter 17 latent semantic analysis LSA LSI mind mapping notes and after-school exercise answers (detailed steps) Chapter 17

Loss after cosine annealing decay of learning rate

jestson安装ibus输入法

Learning rate optimization strategy

Watermelon book / Pumpkin book -- Chapter 1 and 2 Summary

STM32标准外设库(标准库)官网下载方法,附带2021最新标准固件库下载链接

The problem that the user name and password are automatically filled in when Google / Firefox manages the background new account
随机推荐
顺序栈 C语言 进栈 出栈 遍历
《统计学习方法(第2版)》李航 第十三章 无监督学习概论 思维导图笔记
CRC-16 MODBUS code
Machine learning (zhouzhihua) Chapter 5 notes on neural network learning
++cnt1[s1.charAt(i) - ‘a‘];
Qt char型转QString型 16进制与char型 转 16进制整型
读取csv文件的满足条件的行并写入另一个csv中
Jupyter notebook选择conda环境
AD1256
STM32 DSP库MDK VC5\VC6编译错误: 256, (const float64_t *)twiddleCoefF64_256, armBitRevIndexTableF64_256,
JS star scoring effect
Chapter III summary of linear model
MySql与Qt连接、将数据输出到QT的窗口tableWidget详细过程。
【数据库系统原理】第五章 代数和逻辑查询语言:包、扩展操作符、关系逻辑、关系代数与Datalog
Loss after cosine annealing decay of learning rate
Common methods of array
Vscode multiline comments always expand automatically
STM32 DSP library MDK vc5\vc6 compilation error: 256, (const float64_t *) twiddlecoeff64_ 256, armBitRevIndexTableF64_ 256,
[activiti] process example
day2-WebSocket+排序