Qt qDebug() 輸出16進(jìn)制數(shù)字的幾種方法整理:文章來源地址http://www.zghlxwxcb.cn/news/detail-861187.html
1. 代碼
qDebug() << Qt::hex << Qt::showbase << 5;
qDebug() << QString::number(5, 16);
qDebug() << (void *) 5;
qDebug() << QString("%1").arg(5, 0, 16);
qDebug() << QString("%1").arg(5,2,16,QLatin1Char('0')).toUpper();
qDebug() << QString().sprintf("%02X",5);
2. 效果
0x5
"5"
0x5
"5"
"05"
"05"
文章來源:http://www.zghlxwxcb.cn/news/detail-861187.html
到了這里,關(guān)于【Qt】qDebug() 輸出16進(jìn)制數(shù)的幾種方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!