1.charAt();查找返回指定位置的字符
var str = "abcdefg";
var s = str.charAt(5); // 下标为5的字符
console.log(s);//f
2.charcodeAt();查找返回指定位置字符的unicdoe码
var str = "abcdefg";
var s = str.charCodeAt(5); // 下标为5的字符的unicdoe码
console.log(s);//102
3.concat();连接字符串
var str = "abc";
var str1 = str.concat("a", "b", "c", "dsdafsdafsad");
console.log(str1);//abcabcdsdafsdafsad
4.slice();字符串截取
var str = "abcdefghijklm";
var str1 = str.slice(1, 5);
console.log(str1);//bcde
5.split();将字符串转换为数组
var str = "abcdefg"
var str1 =str.split("")
console.log(str);//abcdefg
console.log(str1)//["a", "b", "c", "d", "e", "f", "g"]
6.substring();字符串截取
var str = "abcdefghijklm";
var str1 = str.substring(1, 9);//从下边1开始到下边9结束不包括下标9那一项
var str2 = str.substring(9, 1);
console.log(str1);//bcdefghi
console.log(str2);//bcdefghi
7.substr();字符串截取
var str = "abcdefghijklm";
var str1 = str.substr(2, 6);//从下标2开始往后数6个数
console.log(str1);//cdefgh
8.indexOf();遍历字符串;查找包含第一个参数的字符串,如包含返回第一位的下标,停止查找,如没有返回 -1。第二个参数表示从此下标开始查找。
var str = "abcdefabcjklm";
var a = str.indexOf("abc")
var b = str.indexOf("abc", 1);
console.log(a);//0
console.log(b);//6
9.toUpperCase;转大写
var str = "aAbBcCdD";
console.log(str.toUpperCase());//AABBCCDD
10.toLowerCase;转小写
var str = "aAbBcCdD";
console.log(str.toLowerCase());//aabbccdd
11.replace();替换字符串,只能匹配一次
var str = "今天天天天气好好";
var str1 = str.replace("天天", "**");
console.log(str1);//今**天天气好好
12.match();查找字符串
var str = "今天天气好好";
var result = str.match("天天");
console.log(result);//["天天", index: 1, input: "今天天气好好", groups: undefined]
13.search();查找字符串返回下标
var str = "今天天气天天好好";
var result = str.search("天天");
console.log(result);//1
14.startsWith ;判定一个字符串是否以另一个字符串开头
var str = "hello world";
var result = str.startsWith("he");
console.log(result)//true
//当为两个参数时,第二个表示开始位数。
var result = str.startsWith("he",1);
console.log(result)//flase
15.endsWith;判定一个字符串是否以另一个字符串结尾
var str = "hello world";
//检测尾部
var result = str.endsWith("world");
console.log(result);//true
//检测指定位置是否以指定字符结尾
var result1 = str.endsWith("wo", 8);
console.log(result1)//true
16.includes;检测是否包含指定字符串
var str = "hello world";
var result = str.includes("o");
console.log(result);//true
var result1 = str.includes("o", 8);
console.log(result1);//false
17.repeat;重复字符串
var str ="haha"
var str1 = str.repeat(3);
console.log(str1)//hahahahahaha