This article mainly introduces the common methods of String objects in JavaScript, which is very simple and practical. If you need it, refer to the methods provided by the String object for processing strings and characters.
Common Methods:
CharAt (index): returns the character at index in the string.
IndexOf (searchValue, [fromIndex]): This method searches for the first searchValue in the string. If fromIndex is given, the search starts from the position in the string. When the searchValue is found, the first character of the string is returned.
LastIndexOf (searchValue, [fromIndex]): Search for searchValue from the end of the string and report the first instance found.
Substring (indexA, indexB): obtains the substring from indexA to indexB.
ToLowerCase (): converts all characters in the string to lowercase letters.
ToUpperCaser (): converts all characters in the string to uppercase.
Do you know the usage of the String object? I hope you will like this article.