#include "nsString.h" #include "nsAString.h" #include "mozilla/dom/Promise.h" nsAString str; if (str.IsVoid()) { // Do something when nsAString is empty }
#include "nsString.h" #include "nsAString.h" #include "mozilla/dom/Promise.h" nsAString str = NS_LITERAL_STRING("Hello World!"); if (str.IsVoid()) { // Do something when nsAString is empty }This example shows how to use IsVoid to check whether an nsAString object `str` that contains the string "Hello World!" is void or empty. Package Library: Mozilla Gecko C++ Library.