我想用Thymeleaf缩写一个字符串 [英] I want to abbreviate a string with Thymeleaf
问题描述
我有一个表,我想更改一列,该列包含一个字符串.例如:这是我的字符串"->这是我的...".我尝试这样做abbreviate().
< td th:text ="$ {#strings.abbreviate($ {fgp.explanation},10)}"></td>
但是我收到此错误:EL1043E:意外的令牌.预期为"rparen())"但是'lcurly({)'.S {fgp.explanation}包含字符串
您的语法需要更正.
一般情况是: $ {#strings.abbreviate(str,10)}
,所以您需要:
< td th:text ="$ {#strings.abbreviate(fgp.explanation,10)}"> [这是我的...]</td>
>
I have a table and I want to change a column, the column contains a string. For example: "this is my string" --> "this is my...". I try to do this whith abbreviate().
<td th:text="${#strings.abbreviate( ${fgp.explanation}, 10)}"></td>
But I receive this error : EL1043E: Unexpected token. Expected 'rparen())' but was 'lcurly({)'. S{fgp.explanation} contains the string
Your syntax needs to be corrected.
The general case is: ${#strings.abbreviate(str,10)}
so you would want:
<td th:text="${#strings.abbreviate(fgp.explanation, 10)}">[this is my...]</td>
这篇关于我想用Thymeleaf缩写一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!