isEmpty和isNull()区别
一个NULL字符串一定是一个空串,
一个空串未必是一个NULL字符串
例如:
QString().isNull(): //结果为true
QString().isEmpty(); //结果为true
QString("").isNull(); //结果为false
QString("").isEmpty(); //结果为true
批注: 一个NULL字符串就是使用QString的默认构造函数或者使用(const char*)0作为参数的构造函数创建的字符串对象。
QString((const char*)0).isNull(); //结果为true
一个NULL字符串一定是一个空串,
一个空串未必是一个NULL字符串
例如:
QString().isNull(): //结果为true
QString().isEmpty(); //结果为true
QString("").isNull(); //结果为false
QString("").isEmpty(); //结果为true
批注: 一个NULL字符串就是使用QString的默认构造函数或者使用(const char*)0作为参数的构造函数创建的字符串对象。
QString((const char*)0).isNull(); //结果为true