"Freemaker" text, HTML text, remove space, letter case, loop array, string intercept, map value, traverse map

Source: Internet
Author: User

Test code

    @Test    publicvoid  test06 () {        try  {            root.put ("emp "," <span color= ' red ' > Hello Zhang San </span> "); "06.FTL");            "              06.FTL ", fn+" 06.html ");         Catch (Exception e) {            e.printstacktrace ();        }    }

FTL template files

<Body>${emp}<BR/><#--display text-->${emp?html}<BR/><#--Display HTML text-->    <#assigna= "BC"><#--Remove the trailing spaces->a${a?trim}d<BR/>    <#--capital letters, all lowercase, all uppercase-->    <#assignx= "AbC">${x?cap_first}<#--First Letter lowercase-->${x?lower_case}<#--all lowercase-->${x?upper_case}<#--All caps-->        <BR/>    <#--define an array-->    <#assignNums=["1", "2", "3"]/>${nums?size}<#listnums as Num>A.${num}</#list>    <BR/>    <#--can only be two points-->    <#assignNums=1..10/>    <#listnums as Num>B.${num}</#list>    <BR/>    <#--Direct Traversal-->    <#listnums[0..9] as num>C.${num}</#list>    <BR/>    <#--string interception-->${"The river flows eastward" [0..3]}<BR/>    <#--This content can be seen in the document processing hash table built-in function-->    <#--directly take out the map value-->    <#assignUsers={"A": "Zhang San", "B": "John Doe"}/>${users["A"]} ${USERS.A}<BR/>    <#--looping through a map requires the key to be taken out first->    <#assignKeys=users?keys/>    <#listKeys as key>${key}---${users["${key}"}---${users[key]}</#list></Body>

Effect

"Freemaker" text, HTML text, remove space, letter case, loop array, string intercept, map value, traverse map

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.