JS String

length属性:获取字符串的字符个数。(无论中文字符还是英文字符都算1个字符。)
charAt(index)方法:获取指定索引位置的字符。(索引从0开始)
indexOf(‘字符串’,startIndex)方法:获取指定字符串第一次出现的位置。startIndex表示从第几个开始搜索。
split(‘分隔符’,limit);//根据分隔符将一个字符串返回为一个数组。limit表示要返回的数组的最大长度(可自定义)。
substr(startIndex,len)//startIndex开始,截取len个字符。
substring(startIndex,stopIndex)//startIndex开始,截取到stopIndex位置(不包括stopIndex所在的字符)。
toUpperCase()//转换大写、toLowerCase();//转换小写
match()replace()search()方法,正则表达式相关(在JS Dom课程里讲)。
原文地址:https://www.cnblogs.com/dxmfans/p/9434878.html