var str1 = "alex";
var str2 = "tom";
//length 求字符串长度
//charAt() 由下标返回字符
var h = str1.charAt(1);
console.log(h);
//indexOf 由字符or字符串返回下标 注意O大写
console.log(str1.indexOf('al'));
//search 同indexof
console.log(str1.search("le"));
//match 正则匹配
//concat 拼接
var str3 = str1.concat(str2);
console.log(str3);
//replace 替换
var a = "123456789";
var b = "****";
var c = a.replace("4567", b);
console.log(c); //123****89
//slice 切片 左闭右开,顾头不顾尾
console.log(str1.slice(1,2));
//substr 同slice
//split 分割字符串为数组
var str = "1232a2435464a324344a234";
var s1 = str.split("a");
console.log(s1);
var s2 = str.split("a", 2); //后一参数为对数组长度限制
console.log(s2);
//toUpperCase
//toLowerCase