ddekany commented on PR #111: URL: https://github.com/apache/freemarker/pull/111#issuecomment-2252585176
I think the better approach is to introduce a built-in or operator that normalizes blank strings to `null`. After that, all the long existing missing value operators are applicable (see: https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing) . Also, that targets the root of the problem, which is that you really just want either a `null`, or a non-blank `String`, but because of some technical mess in a layer out of your control, both variants can come. As of `s?is_empty`, check `s?has_content`. Maybe there's an overlap. (Also according the above, the question can be if you want to normalize a `" "` to `null`, or only a 0-length string.) As of `s?trim?length == 0`, note that if `s` is `null`, that's actually an error, so that wouldn't even work. That's just one more reason for a dedicated solution of course. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
