找回密码
 立即注册
收起左侧

qt 中有没有进制转换的函数?

3
回复
7458
查看
[复制链接]
累计签到:168 天
连续签到:1 天
来源: 2013-9-18 13:54:31 显示全部楼层 |阅读模式
1Qter豆
例如:我想调用一个函数实现二进制,十进制,八进制,十六进制之间的转换。。。。。求解啊!

最佳答案

查看完整内容

有啊,看文档赛说的很清楚,2-36进制 int QString::toInt ( bool * ok = 0, int base = 10 ) const Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If a conversion error occurs, *ok is set to false; otherwise *ok is set to true. If base is 0, the C language convention is used: If the string begins with ...
回复

使用道具 举报

累计签到:410 天
连续签到:1 天
2013-9-18 13:54:32 显示全部楼层
有啊,看文档赛说的很清楚,2-36进制
int QString::toInt ( bool * ok = 0, int base = 10 ) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
参与人数 1人气 +1 收起 理由
cll + 1 很实用!

查看全部评分总评分 : 人气 +1

回复

使用道具 举报

累计签到:410 天
连续签到:1 天
2013-9-18 17:27:07 显示全部楼层
QString & QString::setNum ( int n, int base = 10 )
Sets the string to the printed value of n in the specified base, and returns a reference to the string.

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.

看你自己怎么用
回复

使用道具 举报

累计签到:168 天
连续签到:1 天
2013-9-24 21:13:13 显示全部楼层
thank you ,I will try .对于初学者的我,看文档还是有点困难,,,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了