JS in Split (), indexof (). substring (), join () method summary

Source: Internet
Author: User

1.join (separator): Converts an array into a separator-delimited string

2.split (separator): Use a specified delimiter (separator) to store a string in an array

3.indexof (): Returns the subscript of the first character of a matched substring in a string

4.substring ():: String intercept

Precautions:

1. If you use "." As a separate word, it must be written as follows: String.Split ("\ \"), in order to properly separate, can not be used String.Split (".");
2. If you use "|" As a separate word, it must be written as follows: String.Split ("\\|"), so as to properly separate, can not be used String.Split ("|");
3, if the "\" as a separate words, must be the following wording: String.Split (\\\), so that the correct separation, can not be used String.Split ("\");
".", "|" and "\" are both escape characters, must be added "\ \";
4. If you have more than one delimiter in a string, you can use the ' | ' As a hyphen, for example: "Acount=?" and UU =? Or n=? ", the three are separated out, you can use String.Split (" And|or ");

JS in Split (), indexof (). substring (), join () method summary

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.