I'm using C++ Builder XE6. I'm getting a UnicodeString as a parameter and I wish to check if the string is set to NULL, and not an empty string.
I've tried to do some simple compares to see if the param is null, but seem to be failing. I'm using the == operator which doesn't seem to be working, which makes me think it is overloaded.
I've tried:
if (searchString == NULL)
In the debugger view, it shows the value of { NULL } in the local variables. If I add the variable to the watch list, then it shows it has a property of "Data" which is NULL.

Any ideas on how I can properly do the compare?
There is no such thing as a
NULLvalue for aUnicodeString. A string is a series of characters, butNULLis a pointer (well - actually it is a macro that evaluates to an int,0, but it is supposed to be used to indicate null pointers if your compiler doesn't supportnullptr).Internally, the
datamember ofUnicodeStringis NULL when the string is empty, and non-NULL when the string has at least 1 character.To check if the string is empty, use the
IsEmpty()method, which checks if thedatamember is NULL or not. There is only one empty state; there is no distinction between "empty" and "null" like some languages have.The value you see in the debugger is the internal
datamember ofUnicodeString, it is not a part ofUnicodeString's interface. When you see NULL in the debugger, you should treat it as being an empty string.