Just addign my bit here – it seems the trim() function in Mendix auto-initialises any string with a value of null. This basically means that you never have to do an empty check on a string before running trim(). Best practice here, I'd say, is to use
trim($variable) != '’ => this will always work, and is the cleanest code.
Do remember that in Java, or any other language, we first do an empty check, and only then can run a string function, or else we will get a nullpointer error.
Best regards,
Wouter
empty is the equivalent of null in Java, there is no value at all. ‘’ is a String of zero length.
When I validate a String has content, I always check for not empty and that a trimmed version of the string does not equal ‘’.
You can also use IsEmtpyString and IsNotEmptyString in the Community Commons module to do a similar thing.
Hope this helps.