Qt 数值进制转换

来源:互联网 发布:中兴编程挑战赛 编辑:程序博客网 时间:2024/06/05 15:56
QString::number(63,16).toUpper()  //"3F"
QString::number(63,16)   //“3f”

QString QString::number ( long n, int base = 10 ) [static]
Returns a string equivalent of the number n according to the specified base.
The base is 10 by default and must be between 2 and 36. For bases other than 10, n is treated as an unsigned integer.
     long a = 63;
     QString s = QString::number(a, 16);             // s == "3f"
     QString t = QString::number(a, 16).toUpper();     // t == "3F"
See also setNum().
QString QString::number ( double n, char format = 'g', int precision = 6 ) [static]
Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.
Unlike QLocale::toString(), this function does not honor the user's locale settings.
See also setNum() and QLocale::toString().
QString QString::number ( ulong n, int base = 10 ) [static]
This is an overloaded function.
QString QString::number ( int n, int base = 10 ) [static]
This is an overloaded function.
QString QString::number ( uint n, int base = 10 ) [static]
This is an overloaded function.
QString QString::number ( qlonglong n, int base = 10 ) [static]
This is an overloaded function.
QString QString::number ( qulonglong n, int base = 10 ) [static]
This is an overloaded function.
原创粉丝点击