JavaScript 字符串对象

字符串String使用长度属性length来计算字符串的长度
在字符串中查找字符串
字符串使用 indexOf()来定位字符串中某一个指定的字符首次出现的位置
如果没找到对应的字符函数返回-1
lastIndexOf()方法在字符串末尾开始查找字符串出现的位置
内容匹配
match()函数用来查找字符串中特定的字符
并且如果找到的话,则返回这个字符
替换内容
replace()方法在字符串中用某些字符替换另一些字符
字符串大小写转换
字符串大小写转换使用函数 toUpperCase() / toLowerCase()
字符串转为数组
字符串使用split()函数转为数组

字符串属性

length
prototype
constructor

字符串方法

charAt()
charCodeAt()
concat()
fromCharCode()
indexOf()
lastIndexOf()
match()
replace()
search()
slice()
split()
substr()
substring()
toLowerCase()
toUpperCase()
valueOf()

猜你喜欢

转载自blog.csdn.net/weixin_43794314/article/details/86423077