C++ Qt return empty QString -


i made function returns qstring. @ points in function should return empty qstring.

just returning "" doesn't work. when use qstring::isempty() it's not. "emergency plan" return "empty" string , check whether text "empty". don't think that's style.

so how return empty qstring?

the idiomatic way create empty qstring using default constructor, i.e. qstring(). qstring() creates string both isempty() , isnull() return true.

a qstring created using literal "" empty (isempty() returns true) not null (isnull() returns false).

both have size()/length() of 0.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -