subs
subs

Reputation: 2249

Check if std::wstring is null or empty

How to check if an std::wstring is null or empty?

Upvotes: 19

Views: 24085

Answers (1)

GManNickG
GManNickG

Reputation: 503765

wstring is not a pointer, it cannot be null. You can check if it's empty (that is, is equivalent to "") either by direct comparison to the previous, or by:

str.empty(); // == (str.size() == 0)

Upvotes: 35

Related Questions