Freemarker frequently used built-in functions

Source: Internet
Author: User
Tags hash numeric lowercase numeric value
freemarker commonly used built-in functions Freemarker frequently used built-in functions: One, sequence built-in function 1.sequence?first returns the first value of sequence. 2.sequence?last returns the last value of the sequence. 3.sequence?reverse reverses the existing order of sequence, that is, the reverse sort 4.sequence?size returns the size of sequence 5.sequence?sort the order in which the objects in sequence are converted to strings 6. Sequence?sort_by (value) is sorted by the property value of the object in sequence Note: Sequence cannot be nullThe built-in function of the hash 1.hash?keys returns all the keys in the hash, returns the result as sequence 2.hash?values returns all the value in the hash, and returns the result as sequence three, the action string function 1. SUBSTRING (start,end) intercepts substrings from a string
Start: Intercept the index at which the substring starts, start must be greater than or equal to 0, less than or equal to end
End: Truncate the length of the substring, end must be greater than or equal to 0, less than or equal to the length of the string, if omitted, the string length is the default. 2.cap_first the first word in a string to uppercase. 3.uncap_first the first word in a string into lowercase. 4.capitalize capitalize the first letter of all the words in a string 5.date,time,datetime convert the string to a date
Note: If the specified string is malformed, an error is raised 6.ends_with determine whether a string is terminated by a substring, and returns a Boolean value
Note: The Boolean value must be converted to a string to output 7.html to replace <, >, &, and "in the string with the corresponding <>&quot:&amp 8.index_of (substring, Start) finds a substring in a string, returns the index of the first character of the substring found, and returns 1 if no substring is found.
The start parameter is used to specify that the search starts at that index of the string and start is a numeric value.
If start is greater than the string length, the start value equals the string length, and if start is less than 0, start takes a value of 0. 9.length returns the length of a string 10.lower_case the string to lowercase 11.upper_case the string to uppercase 12.contains determines whether a substring is included in the character. Returns a Boolean value
Note: The Boolean value must be converted to a string to output 13.number converting a string to a number 14.replace is used to replace a part of a string from left to right with a different string. 15.split splits a string into a set of strings using the specified delimiter 16.trim delete string Four, the action number 1.c used to convert a number to a string 2.string used to convert a number to a string
Three number formats were booked in Freemarker: number,currency (currency) and percent (percent) where number is the default numeric format conversion

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.