JavaScript String API Simple description

Source: Internet
Author: User

1, can return the character of the specified position

Stringobject.charat (index);

2, returns the encoding of the character at the specified position

Stringobject.charcodeat (index);

3, used to concatenate two or more strings, return new string does not modify the original string

Stringobject.concat (Stringx,stringx,..., stringx);

4. Returns the position of the first occurrence of a specified string value in the string, fromindex means starting from the subscript

Stringobject.indexof (Searchvalue,fromindex);

5. Returns the position of the last occurrence of a specified string value, Fromindex, starting with the subscript (but note that the number is reversed)

Stringobject.lastindexof (Searchvalue,fromindex);

6, you can retrieve the specified value within a string, or find the match of one or more regular expressions

Stringobject.match (Searchvalue); Stringobject.match (regexp);

7, the string replaces some characters with some other characters, or replaces a substring that matches a regular expression, returns a new string without modifying the original string

Stringobject.replace (regexp/substr,replacement);

8, used to retrieve a substring specified in a string, or to retrieve a substring that matches a regular expression

Stringobject.search (RegExp);

9. Can extract a part of a string and return the extracted part with a new string

Stringobject.slice (Start,end);

10, divides a string into the string array, separator expresses to divide the cutting point, howmany represents the maximum length

Stringobject.split (Separator,howmany);

11. You can extract a specified number of characters from the start subscript in a string, start can be negative, 1 means the last-2 countdown to the first and so on, length

Stringobject.substr (start,length);

12. A character used to extract a string between two specified subscripts

Stringobject.substring (Start,stop);

JavaScript String API Simple description

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.