El expression function-get String Length, cut...

Source: Internet
Author: User

1. FN: Contains determine whether the string contains another string

(Name, searchstring)} ">  

2. FN: containsignorecase judge whether the string contains another string (case-insensitive)

Test = "$ {fn: containsignorecase (name, searchstring)}">  

3. FN: endswith: Determine whether the string ends with another string

(Filename, ". txt")} ">  

4. FN: escapexml converts some characters into XML Representation. For example, <character should be converted to <

$ {Fn: escapexml (Param: INFO )}  

5. FN: indexof position where the substring appears in the parent string
$ {Fn: indexof (name ,"-")}  

6. FN: Join combines the data in the array into a new string and uses the specified character lattice to open $ {fn: Join

(Array ,";")}  

7. FN: length get the length of the string, or the size of the array $ {fn: Length

(Shoppingcart. Products )}  

8. FN: Replace the specified character $ {fn: Replace (text,
"-","")}  

9. FN: Split the string according to the specified characters
$ {Fn: Split (customernames ,";")}  

10. FN: startswith determines whether the string starts with a substring.

(Product. ID, "100-")} ">  

11. FN: substring get substring $ {fn: substring (ZIP,
6,-1 )}  
12. FN: substringafter get the substring starting from the position of a character $ {fn: substringafter

(ZIP ,"-")}  

13. FN: substringbefore obtains the substring from the start to the position of a character.

$ {Fn: substringbefore (ZIP ,"-")}  

14. FN: tolowercase
Convert to lower case $ {fn. tolowercase (product. Name )}  

15. FN: touppercase
Convert to uppercase characters $ {fn. uppercase (product. Name )}  

16. FN: Remove spaces before and after the trim string $ {fn. Trim (name )}

 

It is easier to understand the function library as the tag library. Because Functions
The tag library does not provide a traditional tag to serve JSP pages, but is used in El expression statements. The
The functions tag Library provides many more useful functions for El expression statements. The functions tag library is divided into two categories, a total of 16
Functions.
Length function: FN: Length
String processing functions: FN: Contains, FN: containsignorecase, FN: endswith
FN: escapexml, FN: indexof, FN: Join, FN: replace, FN: Split
FN: startswith, FN: substring, FN: substringafter
FN: substringbefore, FN: tolowercase, FN: touppercase
FN: trim
The following is a simple example of the usage and properties of each function.
9.7.1Length function FN: length Function
    Length Functions
FN: the appearance of length has important significance. In jstl1.0
Is ignored, that is, the length value of the set. Although the java. util. Collection interface defines the size
Method, but this method is not a standard JavaBean attribute method (no get or set method). Therefore, the El expression"
$ {Collection. Size} "for easy acquisition.
FN: The length function is designed to solve this problem. Its parameter is
Input: calculates the length of the object passed in through this attribute. This object should be of the collection type or string type. The returned result is
Int type value. The following is an example.

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.