Checking strings for and empty

2
Hi all, I found that the easiest way to check strings for empty or ‘’ is to use trim($string)='' This works since trim(empty) results in ‘’ – however this is not documented https://docs.mendix.com/refguide/string-function-calls#11-trim Is it safe to to use this, or is there a risk this might break with a new Mendix version? regards, Fabian
asked
2 answers
3

Exactly same discussion yesterday with my fellow Mendix trainer.

Current situation is that it’s save, but my argument was to create a rule which checks on

trim($string != ''
and
$string != empty

This generates no overhead, only a fall back if….

Better save then sorry

 

answered
2

Use a rule for that. There are two in the community commons: isempty and isnotempty.

Regards,

Ronald

 

answered