How can I check if a string variable is null or empty, or full with space characters in Twig? (Shortest possible, maybe an equivalent to CSharp's String.IsNullOrWhiteSpace()
method)
{% if your_variable is null or your_variable is empty %}
should check whether the variable is null or empty.
If you want to see if it's not null or empty just use the not
operator.
{% if foo is not null and foo is not empty %}
See the docs:
Perhaps you might be interested in tests in twig generally.