当前位置:网站首页>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);
边栏推荐
- CRC-16 Modbus代码
- Learning rate optimization strategy
- [activiti] Introduction to activiti
- JUC并发编程基础(9)--线程池
- 主成分分析计算步骤
- 信号与系统:希尔伯特变换
- day6-jvm
- Statistical learning methods (2nd Edition) Li Hang Chapter 22 summary of unsupervised learning methods mind mapping notes
- JUC并发编程基础(8)--读写锁
- Loss after cosine annealing decay of learning rate
猜你喜欢

Signals and systems: Hilbert transform

【数据库系统原理】第四章 高级数据库模型:统一建模语言UML、对象定义语言ODL

Add se channel attention module to the network
![[USB host] stm32h7 cubemx porting USB host with FreeRTOS to read USB disk, usbh_ Process_ The OS is stuck. There is a value of 0xa5a5a5](/img/be/b7723920f0e81e8699bb26dd1c0fe5.png)
[USB host] stm32h7 cubemx porting USB host with FreeRTOS to read USB disk, usbh_ Process_ The OS is stuck. There is a value of 0xa5a5a5

第三章 线性模型总结

树莓派大用处,利用校园网搭建一个校园局域网站

jestson安装ibus输入法
![[activiti] activiti environment configuration](/img/7f/7a3dc16bc4795df3eab5741618bd9d.png)
[activiti] activiti environment configuration

STM32 DSP库MDK VC5\VC6编译错误: 256, (const float64_t *)twiddleCoefF64_256, armBitRevIndexTableF64_256,

Delete the weight of the head part of the classification network pre training weight and modify the weight name
随机推荐
[activiti] group task
Raspberry pie is of great use. Use the campus network to build a campus local website
STM32 DSP library MDK vc5\vc6 compilation error: 256, (const float64_t *) twiddlecoeff64_ 256, armBitRevIndexTableF64_ 256,
测试数据增强后标签和数据集是否对应
Qt新建工程简介
在网络中添加spp模块中的注意点
顺序栈 C语言 进栈 出栈 遍历
Deepsort summary
STM32 DSP库MDK VC5\VC6编译错误: 256, (const float64_t *)twiddleCoefF64_256, armBitRevIndexTableF64_256,
字符串方法以及实例
《剑指Offer》 二维数组的查找 C语言版本
json.dumps()函数解析
AD1256
labelme转voc代码中的一个小问题
CRC-16 Modbus代码
AD1256
Typora 安装包2021年11月最后一次免费版本的安装包下载V13.6.1
day2-WebSocket+排序
Iotp2pgate two IOT devices point-to-point communication fast implementation scheme
[activiti] activiti introduction