Summary of js string operation functions. Concat ()-combines two or more characters to return a new string.
IndexOf ()-returns the index at the first part of a substring in a string. If no match exists,-1 is returned.
CharAt ()-returns the character at the specified position.
LastIndexOf ()-returns the index of the last occurrence of a substring in the string. If no match exists,-1 is returned.
Match ()-check whether a string matches a regular expression.
Substring ()-returns a substring of a string. The input parameters are the start position and end position.
Replace ()-used to find a string that matches a regular expression, and then use a new string to replace the matched string.
Search ()-execute a regular expression to match the search results. If the search is successful, the matching index value in the string is returned. Otherwise,-1 is returned.
Slice ()-extract part of the string and return a new string.
Split ()-divides a string into substrings to form a string array.
Length-returns the length of a string. The so-called length of a string refers to the number of characters it contains.
ToLowerCase ()-converts the entire string into lowercase letters.
ToUpperCase ()-converts the entire string into uppercase letters.
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.