Home > Web Front-end > JS Tutorial > body text

A brief discussion on common methods of String objects in JavaScript_javascript skills

WBOY
Release: 2016-05-16 16:13:03
Original
1131 people have browsed it

The methods provided by the String object are used to process strings and characters.
Some commonly used methods:

charAt(index): Returns the character at index in the string.
indexOf(searchValue,[fromIndex]): This method looks for the first occurrence of searchValue in the string. If fromIndex is given, the search starts from this position within the string. When searchValue is found, the position of the first character of the string is returned.
lastIndexOf(searchValue,[fromIndex]): Searches searchValue forward from the end of the string and reports the first instance found.
substring(indexA,indexB): Get the substring from indexA to indexB
toLowerCase(): Convert all characters in the string to lowercase
toUpperCaser(): Convert all characters in the string to uppercase

Have you guys understood the usage of String objects? I hope you like this article.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template