JavaScript String(字符串)对象

计算字符串的长度:document.write(txt.length)

为字符添加样式:document.write( txt.big() )【Big可替换】

用 indexOf() 来定位字符串中某一个指定的字符首次出现的位置:document.write(str.indexOf("字符"))

使用 match() 来查找并返回字符串中特定的字符:document.write(str.match("字符"))

使用 replace() 方法在字符串中替换字符:document.write(str.replace(/原本字符/,"替代后的字符"))


猜你喜欢

转载自blog.csdn.net/youngkiko/article/details/80997943
今日推荐