Array traversal Map/foreach and string cut split

Source: Internet
Author: User
Tags truncated

1.map ()

Description

Instance:

2.forEach ()

Description

Instance:

3.split ()

Description

Instance:

4.slice ()

Description

The first parameter represents the start position, the second parameter represents the next position of the end position, the length of the truncated string is the difference between the second parameter and the first parameter, and if the value of the parameter is negative, the value is added to a positive number after the string length, or an empty string if the first argument equals greater than the second argument.

Instance:

5.substring ()

Description

The first parameter represents the start position, the second parameter represents the next position of the end position, and if the value of the parameter is negative, the value is converted to 0, and the two parameter takes a smaller value as the starting position, and the length of the truncated string is the difference between the larger value and the smaller value.

Instance:

6.substr ()

Description

The first parameter represents the start position, and the second parameter represents the length of the Intercept

Instance:

Array traversal Map/foreach and string cut split

Related Article

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.