Qt: QString::isEmpty()与QString::isNull()区别
2015-07-20 22:45
281 查看
Qt: QString::isEmpty()与QString::isNull()
bool QString::isEmpty () const
Returns true if the string has no characters; otherwise returns false.
Example:
QString().isEmpty(); // returns true
QString("").isEmpty(); // returns true
QString("x").isEmpty(); // returns false
QString("abc").isEmpty(); // returns false
See also size().
bool QString::isNull () const
Returns true if this string is null; otherwise returns false.
Example:
QString().isNull(); // returns true
QString("").isNull(); // returns false
QString("abc").isNull(); // returns false
Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is whether or not a string contains any data, and this can be determined using the isEmpty() function.
bool QString::isEmpty () const
Returns true if the string has no characters; otherwise returns false.
Example:
QString().isEmpty(); // returns true
QString("").isEmpty(); // returns true
QString("x").isEmpty(); // returns false
QString("abc").isEmpty(); // returns false
See also size().
bool QString::isNull () const
Returns true if this string is null; otherwise returns false.
Example:
QString().isNull(); // returns true
QString("").isNull(); // returns false
QString("abc").isNull(); // returns false
Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is whether or not a string contains any data, and this can be determined using the isEmpty() function.
相关文章推荐
- 2. QT窗体间值的传递
- Qt MVC学习 模型子类化参考(二)
- Qt中show()与exec()
- PyQt之QHBoxLayout、QVBoxLayout 与QGridLayout
- Qt Creator中,include路径包含过程(或如何找到对应的头文件)
- QT获取网页内容
- PyQt的安装和使用案例
- Qt的一些基础知识
- QT中QWidget、QDialog及QMainWindow的区别
- qt线程动态回调被调类中的函数
- Qt学习之一,键盘事件细节
- QT 的信号与槽机制介绍
- 为qt添加sql驱动
- PyQt的Layout的比例化分块。
- QT中PRO文件写法
- ubuntu13.04下安装Qt5.5.0
- Qt自带的自动打包dll工具使用方法
- Qt5该插件机制(7)--插件开发演示示例代码(Lower-level API)
- Qt浅谈之三十系统托盘(QSystemTrayIcon)
- Ubuntu下创建QT桌面快捷方式