您的位置:首页 > 其它

QString isEmpty isNull

2016-07-28 13:41 489 查看


bool QString::isEmpty () const

如果字符串为空,也就是如果length() == 0,返回真。因此,零字符串也是空字符串。

QString a( "" );
a.isEmpty();        // 真
a.isNull();         // 假

QString b;
b.isEmpty();        // 真
b.isNull();         // 真


也可以参考isNull()和length()。
实例:addressbook/mainwindow.cppchart/chartform.cppchart/chartform_canvas.cppnetwork/networkprotocol/nntp.cppqmag/qmag.cppqwerty/qwerty.cpp


bool QString::isNull () const

如果字符串为零,返回真。零字符串总是空的。

QString a;          // a.unicode() == 0,a.length() == 0
a.isNull();         // 真,因为a.unicode() == 0
a.isEmpty();        // 真


也可以参考isEmpty()和length()。
实例:i18n/main.cppqdir/qdir.cpp

转自:http://www.kuqin.com/qtdocument/qstring.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: