zoukankan      html  css  js  c++  java
  • freemarker1 一些内建函数和用法

    ${"   green mouse"?cap_first} -->   Green mouse  //字符串中的第一个单词的首字母大写

    ${"ABCDF"?lower_case} --> abcdf  //字符串小写形式

    [${"a"?left_pad(5)}]  --> [    a] //距左边 如果它仅仅用1个参数,将在字符串的开始插入空白,知道整个串的长度达到参数指定的值. 如果字符串长度达到或者超过指定的长度,就什么都不做.
    [${"a"?left_pad(8,".oO")}] -->[.oO.oO.a]//第二个参数也可以是长度比1大的字符串,这个字符串会周期性的插入.

    <#if "piceous"?contains("ice")>It contains "ice"<#/if> --> It contains "ice"  //contains 包含

    ${"aaaaa"?repalce("aaa","XX")} --> XXaa  //在元字符串中,用另外一个字符串来替换原字符串中出现它的部分 不处理词的边界

    <#assign x= 's/b c'>  ${x?url}  --> a%2Fb%20c  //通常引用的属性值,用普通引号("")包括,而不是单引号(''),因为单引号是不被URL转义的,

    <#list "someMOOtestMOOtext"?split("MOO" as x)>

     -${x}

    </#list>                           -->   -some -test - text //split 分割,

    (${"   green mouse  "}?trim) --> (green mouse)  //trim 去掉字符串首尾的空格

    <替换为&lt;

     >替换为&gt;

     &替换为&amp;

     "替换为&quot; 

    '替换为&#39

    学习是枯燥的.

  • 相关阅读:
    SharePoint Development
    win32- copyfile的使用
    SetWindowHookEx的复习
    C++ vector的使用
    关于char * 和 char [] 的一点理解
    CreateThread
    C++字符串大写字母转小写字母
    字符串逆序
    使用RegSetValueEx创建键值
    EnumColorProfiles WcsGetDefaultColorProfile WcsSetDefaultColorProfile的使用
  • 原文地址:https://www.cnblogs.com/moli-/p/6489815.html
Copyright © 2011-2022 走看看