freemarker截取字符串subString

时间:2023-03-10 00:40:26
freemarker截取字符串subString

转至:http://fengzhijie1103.iteye.com/blog/1142918

freemarker截取字符串其实和JAVA语法是差不多了,也有substring 方法
    
   如代码:<#assign content=root.keyWord>
     ${content?substring(0,100)}... 这种方法是很常见,对吧
   
   但是freemarker还有一种和substring差不多.这种方法就很好

${root.keyWord[0..100]}... 结果和subString 一样的
   
    但是用法却简单