我正在尝试编写一个函数,它可以获取存储在变量中的字符串的子字符串。
我做了以下
<#global summary_s = getSummarySubstring(activeItem, "44","")>
<#function getSummarySubstring item summaryId>
<#assign Summary = helper.getLinkedItems(item,summaryId,"")>
<#assign SubSummary = ${Summary?substring(0,140)}>
<#return SubSummary >
</#function>
我收到了一条freemarker错误说:
Caused by: freemarker.core.ParseException: Encountered "{" at line 111, column 36 in
remoteIndexing_555_16.
Was expecting one of:
"in" ...
">" ...
<EMPTY_DIRECTIVE_END> ...
"." ...
"[" ...
"(" ...
"?" ...
"!" ...
<TERMINATING_EXCLAM> ...
"??" ...
"+" ...
"-" ...
"*" ...
"/" ...
"%" ...
"!=" ...
"=" ...
"==" ...
">=" ...
<ESCAPED_GTE> ...
">" ...
<STRING_LITERAL> ...
任何人都可以帮忙吗?
答案 0 :(得分:1)
请勿使用${...}
ie:<#assign SubSummary = Summary.substring(0,140)>
${...}
用于打印到输出流