The following is a summary of common methods for JavaScriptString objects. I think it is quite good. Now I want to share it with you. It is immutable to make a reference string for you. The string method does not change the content of the original string, but returns a new string.
CharAt (): returns the character at the specified position.
Concat (): concatenates two string texts and returns a new string.
IndexOf (): indexOf () method returns the position where the specified value first appears in a string object.
Match (): Use a regular expression to compare it with a string.
Replace (): Used to directly compare a regular expression with a string, and then replace the matched substring with a new substring.
Slice (): extract a string region and return a new string.
Split (): separates strings into strings and splits string objects into string arrays.
Substr (): returns the substring from the specified position to the specified length.
Substring (): returns the substring between two indexes (or to the end of the string.
Different from slice () and substr (), substring () does not accept negative parameters.
Trim (): removes spaces at both ends of a string.
The above is a summary of common methods for JavaScript String objects _ javascript tips. For more information, see PHP Chinese website (www.php1.cn )!