1.split(): 将字符串转化为数组,join将数组转化为字符串。不会改变原字符串
var a = "a,b,c,s"; var b = a.split(","); console.log(a);//a,b,c,s console.log(b);//["a", "b", "c", "s"]
2.substr():参数一表示开始的位置,参数二表示提取字符的长度。不会改变原字符串。
var a = "abcdefg"; var b = a.substr(2,3); console.log(a);//abcdefg console.log(b);//cde
3.search()、match()、replace()用法见文章正则表达式
4.slice()用法见文章数组详解
原文:http://www.cnblogs.com/pcd12321/p/5334278.html