<#if thing.title?length gt 33>
${thing.title?substring(0,30)}...
<#else>${thing.title!}
</#if>
当然,也可以对thing.title 外面添加括号,(thing.title)?length gt 33
freemarker中的substring取子串
1、substring取子串介绍
(1)表达式?substring(from,to)
(2)当to为空时,默认的是字符串的长度
(3)from是第一个字符的开始索引,to最后一个字符之后的位置索引
2、举例说明
<#--freemarker中的substring取子串-->
${'EFGHIJKL'?substring(0)}
${'EFGHIJKL'?substring(1)}
${'EFGHIJKL'?substring(2)}
${'EFGHIJKL'?substring(3)}
${'EFGHIJKL'?substring(4)}
${'EFGHIJKL'?substring(5)}
${'EFGHIJKL'?substring(6)}
${'EFGHIJKL'?substring(7)}
${'EFGHIJKL'?substring(8)}
&