freemarker语法完整版(8)

2019-03-29 13:45

<#list seq?chunk(4, '-') as row>

<#list row as cell>${cell} 输出: a b c d e f g h i j a b c d e f

g h i j - - String

${\ this is a backslash: \\\\\

${'It\\'s \ this is a backslash: }

${r\

raw字符串,原封不动地现实引号中的内容

ps:前一种是用双引号来引用字符串,后一种是用单引号来引用字符串。 分别需要对双引号和单引号进行转义

${\ ${user + user + user + user} 效果相同

★substring ${user[0]}${user[4]}

${user[1..4]} ${user[4..]} ★number 不支持科学计数法 小数点前面的零不能省略 ★sequences

<#list [\ ${x}

<#list 2..5 as x> ${x} <#list [2,3,4,5] as x> ${x}

数组的拼接

<#list [\ - ${user} ★hash

<#assign ages = {\ - Joe is ${ages.Joe} - Fred is ${ages.Fred} - Julia is ${ages.Julia}

注意重复的键对应的值取最后的一个 ★运算

${5/2?int} 显示2

cap_first : 首字母大写

capitalize: 所有单词首刺目大写

html : 转换为HTML格式 < replaced with < > replaced with > & replaced with & \ index_of : 显示元素所在的位置 \返回值为1(下标从0开始)

Contains:判断是否存在字符

<#if \输出: It contains \

Replace :替换

split(―XX‖):截取XX之后的字符

<#list \- ${x} 输出: - some - test - text

starts_with :字符串由什么开始返回布尔型

trim :去掉空格

seq_index_of 数组中元素的位置

<#assign colors = [\${colors?seq_index_of(\输出: 2

Default : 设置变量的默认值

Exists:放在if句 如果没有…..

<#if mouse?exists> Mouse found <#else>

No mouse found

Creating mouse...

<#assign mouse = \<#if mouse?exists> Mouse found <#else>

No mouse found 输出 :

No mouse found Creating mouse...


freemarker语法完整版(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:第15期中国企业家特训班名录

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: