Home > Article > Web Front-end > js string operation function_javascript skills
concat() – Concatenates two or more characters of text and returns a new string.
indexOf() – Returns the index of the first occurrence of a substring in a string. If there is no match, -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, or -1 if there is no match.
match() – Checks whether a string matches a regular expression.
substring() – Returns a substring of a string. The incoming parameters are the starting position and the ending position.
replace() – Used to find a string that matches a regular expression and then replace the matching string with a new string.
search() – Performs a regular expression match search. If the search is successful, the matching index value in the string is returned. Otherwise, -1 is returned.
slice() – Extracts a portion of a string and returns a new string.
split() – Converts a string into a string array by dividing the string into substrings.
length – Returns the length of the string. The length of the string refers to the number of characters it contains.
toLowerCase() – Convert the entire string to lowercase letters.
toUpperCase() – Converts the entire string to uppercase letters.