Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - String method in JS
String method in JS
Concat ()–Combines two or more text characters and returns a new string.

index of()–

Returns the index of the first occurrence of a substring in a string. If it does not 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 occurrence.

Match ()–Checks whether the string matches a regular expression.

Substring()- Returns the substring of the string. The parameters passed in are the start position and the end position.

Replace ()-

Used to find a string that matches a regular expression, and then replace the matching string with a new string.

Search ()-

Perform a regular expression matching lookup. If the search is successful, the matching index value in the string is returned. Otherwise, return-1.

Slice()- Extract a part of a string and return a new string.

Split()- Converts a string into an array of strings by splitting it into substrings.

Length-

Returns the length of a string, that is, the number of characters it contains.

ToLowerCase()- Converts the entire string to lowercase letters.

Toupper case()- Converts the entire string to uppercase letters.