当前位置:网站首页>Qt: 判断字符串是否为数字格式
Qt: 判断字符串是否为数字格式
2022-06-24 09:52:00 【小鹰信息技术服务部】
Qt开发,需要实现一个比较基础的功能,判断一个字符串能否转换成数字,例如:
123.45 可以转换成数字;
123.BC 不能转换成数字;
Qt中怎样进行判断呢?研究一番,找到了答案:
bool isNum;
QString a = "123.56";
a.toDouble(&isNum);
qDebug() << "a isNum: " << isNum;
QString b = "123.BC";
b.toDouble(&isNum);
qDebug() << "b isNum: " << isNum;
输出:
参考:
边栏推荐
- Window function row in SQL Server_ number()rank()dense_ rank()
- Pycharm shortcut keys
- Introduction to the use of splice() method
- SwiftUI Swift 内功之 Swift 中的属性观察者 didSet 与 willSet
- Use the process monitor tool to monitor process operations on registries and files
- What is the bin file for? How to open the file correctly
- math_等比数列求和推导&等幂和差推导/两个n次方数之差/
- Canvas pipe animation JS special effect
- Charles packet capturing tool tutorial
- [IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)
猜你喜欢
Differences among cookies, session, localstorage and sessionstorage
Simple pricelist style code
@RequestBody注解
26. delete duplicates of ordered array
First acquaintance with string+ simple usage (I)
图片的可视化呈现有效增强大屏吸引力
SQL Server about like operator (including the problem of field data automatically filling in spaces)
Window function row in SQL Server_ number()rank()dense_ rank()
[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)
【本周六活动】.NET Day in China
随机推荐
≥ 2012r2 configure IIS FTP
Self service troubleshooting guide for redis connection login problems
Ppt drawing related, shortcut keys, aesthetics
Smart energy: scenario application of intelligent security monitoring technology easycvr in the petroleum energy industry
What are the means of network promotion?
A method of generating non repeated numbers in nodejs
什么是递归?
Cool interactive animation JS special effects implemented by p5.js
Any 与 TypeVar,让 IDE 的自动补全更好用
程序员大部分时间不是写代码,而是。。。
Programmers spend most of their time not writing code, but...
splice()方法的使用介绍
Fashionable pop-up mode login registration window
What is the function of the graphics card driver? Do you want to update the graphics card driver
Tencent geek challenge small - endless!
Centripetalnet: more reasonable corner matching, improved cornernet | CVPR 2020 in many aspects
如何只导出word文档中的标题?(即将正文内容都删除,只保留标题)B站牛逼
math_ Summation and derivation of proportional series & derivation of sum and difference of equal powers / difference between two nth power numbers/
【IEEE】自然语言处理与信息检索国际会议(ECNLPIR 2022)
Tencent wetest platform will bring new benefits in 2021 with 618 special offers!