QString判断空 isEmpty

isEmpty

Returns true if the string has no characters; otherwise returns false.

 QString().isEmpty();            // returns true
 QString("").isEmpty();          // returns true
 QString("x").isEmpty();         // returns false
 QString("abc").isEmpty();       // returns false

isNull

Returns true if this string is null; otherwise returns false.

 QString().isNull();             // returns true
 QString("").isNull();           // returns false
 QString("abc").isNull();        // returns false
posted @ 2018-08-22 15:57  thomas_blog  阅读(1627)  评论(0编辑  收藏  举报