Use velocity tips and velocity tips

Source: Internet
Author: User

Use velocity tips and velocity tips

Due to the company's needs, I used the velocity template for file generation. Here are some tips for using the velocity template:

 

1. when intercepting a string, note that (1) Use. length () is used to obtain the string length. (2) it is best to replace "-1" in the form of "+ (-1)", because velocity does not support minus, easy to confuse. 2. $ velocityCount (Cyclic traversal counter) We need to operate between strings (for example, adding a comma or other identical symbols) after character traversal, but the last character, we do not need to add it. In this case, we need to use $ velocityCount for operations. After traversing the string, use "," to separate the output, and the last one does not add ",". Note that $ velocityCount will automatically + 1 for each loop. Here fields. size () is the length of the set.

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.