DotLiquid - 检查字符串"null或empty"

mar*_*c_s 2 c# asp.net dotliquid

我在我的ASP.NET 4.0 Webforms应用程序中使用DotLiquid作为一些电子邮件模板,并且我试图排除我的一个电子邮件模板的某个部分,如果数据对象中的给定字符串我绑定到模板为空或空.

检查NULL非常有效:

{% if MyString != null %}

Some fancy label: {{ MyString }}
{% endif %}";
Run Code Online (Sandbox Code Playgroud)

但是,无论我试图在此测试中包含字符串到目前为止都失败了:

{% if MyString != null or MyString == empty %}

{% if MyString != null or MyString == '' %}
Run Code Online (Sandbox Code Playgroud)

如何检查"如果此字符串为空或空"?

410*_*one 9

经过评论讨论后,这是一个简单的逻辑错误.

{% if MyString != null and MyString != "" %}