1. Calculate the length of the string
var txt="Hello World!"
document.write(txt.length)
2.indexOf() method
How to use indexOf () to locate the first occurrence of a specified character in a string.
3.match() method
searches for a specific character in a string, and if found, returns this character.
4. How to replace characters in a string - replace()
Use the replace() method to replace certain characters with other characters in a string.
Statement: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