JSTLfmt, fn tag Library

Source: Internet
Author: User
1. bundle is used to bind the resource configuration file and displayed on the page. Example code: 2. The formatDate label is used for the & amp; 26684; format date. Example code: 3. The formatNumber label is used for & amp; 26684; to convert a number. DEMO code:

1. bundle

Used to bind the resource configuration file and display it on the page.

DEMO code:

2. formatDate

Tags are used to format the date.

DEMO code:

3. formatNumber

The label is used to format numbers.

DEMO code:

4. message

The tag used for information display. The information defined in the resource configuration file is displayed.

DEMO code:

5. parseDate

The tag is used to parse a Date and return the result as an instance of the java. lang. Date type.

DEMO code:

6. parseNumber

The tag is used to parse a Number and return the result as an instance of the java. lang. Number class.

DEMO code:

7. requestEncoding

Tags are used to set character encoding for requests. It has only one attribute value, which can define character encoding.

DEMO code:

Format Text Encoding

8. setLocale

Label is used to set the localization environment.

DEMO code:

9. timeZone

, Both sets of labels are used to set a time zone.
DEMO code:

...

10. contains

Fn: The contains function is used to determine whether the source string contains a substring. It includes two parameters: string and substring. They are both String types. distribution indicates the source string and sub-String. The returned result is a boolean value. The following is an example.

$ {Fn: contains ("ABC", "")}

$ {Fn: contains ("ABC", "")}

The former returns "false", and the latter returns "true ".

11. containsIgnoreCase

The fn: containsIgnoreCase function is similar to the fn: contains function. The only difference is that the fn: containsIgnoreCase function is case-insensitive for the inclusion of sub-strings.
DEMO code:
$ {Fn: containsIgnoreCase ("ABC", "")}

$ {Fn: containsIgnoreCase ("ABC", "")}

Both the former and the latter return "true ".

12. indexOf

The fn: indexOf function is used to obtain the starting position where the substring matches the source string. If the substring does not match the content of the source string, "-1" is returned ".

DEMO code:

$ {Fn: indexOf ("ABCD", "aBC ")}

-1 is returned because no matching is successful.

13. length

Obtain the length of the result set, similar to the size method defined by java. util. Collection interface.

DEMO code:

$ {Fn: length (sessionScope. arrayList1 )}

14. replace

Fn: The replace function allows replacement of source strings.

DEMO code:

$ {Fn: replace ("ABC", "A", "B ")}

Replace the "ABC" string with "BBC" and "A" with "B" in the "ABC" string ".

15. split

Fn: The split function is used to convert a group of strings separated by delimiters into string arrays.

DEMO code:

$ {Fn: split ("A, B, C ",",")}

Convert the string "A, B, C" to an array {A, B, C }.

16. startsWith

Fn: The startsWith function is used to determine whether the source string conforms to a series of specific word headers.

DEMO code:

$ {Fn: startsWith ("ABC", "AB ")}

Returns false.

17. substring

Fn: The substring function is used to intercept a string. Its parameters, returned results, and descriptions.

DEMO code:

$ {Fn: substring ("ABC", "1", "2 ")}

The Truncation result is "B ".

18. toLowerCase

Fn: The toLowerCase function allows you to convert all characters in the source string to lowercase characters.

DEMO code:

$ {Fn: toLowerCase ("ABCD ")}

The conversion result is "abcd ".

19. toUpperCase

Fn: The toUpperCase function allows you to convert all the characters in the source string to uppercase or lowercase characters.

DEMO code:

$ {Fn: toUpperCase ("abcd ")}

The conversion result is "ABCD ".

20. trim

Fn: the trim function deletes the "space" at the end of the source string to generate a new string.

DEMO code:

$ {Fn: trim ("AB C")} D

The conversion result is "AB cd". Note that it will only delete spaces at the end of the word rather than all. Therefore, there is still a space between "B" and "C.

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.