Common methods for string and array

Source: Internet
Author: User

common methods of stringscharAt () returns the character at the specified index positioncharCodeAt () returns the Unicode value of the specified index position characterconcat () joins two or more strings, returning the concatenated stringfromCharCode () converts Unicode to a stringindexOf () returns the position of the first occurrence of the specified character in a stringlastIndexOf () returns the position of the last occurrence of the specified character in a stringLocalecompare () compares two strings in a local-specific orderMatch () finds the matching of one or more regular expressionsreplace () replaces a substring that matches a regular expressionSearch () retrieves a value that matches a regular expressionSlice () extracts a fragment of a string and returns the extracted part in a new stringSplit () splits a string into a substring arraysubstr () extracts a specified number of characters from the starting index number in a stringsubstring () extracts the characters between two specified index numbers in a stringtolocalelowercase () converts a string to lowercase based on the host's locale, with only a few languages (such as Turkish) with a local case-specific mappingtolocaleuppercase () converts a string to uppercase based on the host's locale, with only a few languages (such as Turkish) with a local case-specific mappingtoLowerCase () converts a string to lowercasetoString () returns the string object valuetoUpperCase () converts a string to uppercasetrim () Remove string end and end blanksvalueOf () returns the original value of a string objectcommon methods for arraysconcat () joins two or more arrays and returns the result. join () places all elements of an array into a string. element is delimited by the specified delimiter. pop () deletes and returns the last element of the arraypush () adds one or more elements to the end of the array and returns the new length. reverse () reverses the order of the elements in the array. shift () deletes and returns the first element of the arraySlice () returns the selected element from an existing arraysort () sorts the elements of an arraySplice () deletes the element and adds a new element to the array. Tosource () returns the source code of the object. toString () converts the array to a string and returns the result. the elements in the array are separated by commas . tolocalestring () converts the array to a local array and returns the result. Unshift () adds one or more elements to the beginning of the array and returns the new length. valueOf () returns the original value of the array object

Common methods for string and array

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.