weixin_44163782 2022-09-03 23:51 采纳率: 70%
浏览 27
已结题

qt中qstring类的toint(0,0)是啥意思嘞,请教各位兄弟姐妹

最近看代码时遇到别人写的代码里有用到toInt(0,0)觉得不可思议,0难道可以当底数?

img

  • 写回答

2条回答 默认 最新

  • _GX_ 2022-09-04 02:10
    关注

    Qt文档里已经写得很清楚了。

    int QString::toInt(bool *ok = nullptr, 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 ok is not nullptr, failure is reported by setting *ok to false, and success by setting *ok to true.

    If base is 0, the C language convention is used: if the string begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 5月24日
  • 已采纳回答 5月16日
  • 创建了问题 9月3日

悬赏问题

  • ¥30 模拟电路 logisim
  • ¥15 PVE8.2.7无法成功使用a5000的vGPU,什么原因
  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Bug traq 数据包 大概什么价