标签:
str.replace(/<\/?[^>]*>/g,‘‘); //去除HTML tag
str.replace(/[ | ]*\n/g,‘\n‘); //去除行尾空白
str.replace(/\n[\s| | ]*\r/g,‘\n‘); //去除多余空行
str.replace(/ /ig,‘‘);//去掉
str.replace(/^[\s ]+|[\s ]+$/g, "");//去掉全角半角空格
str.replace(/[\r\n]/g,"");//去掉回车换行
str.replace(/(^/s*)|(/s*$)/g, ""); // 去掉左右空格
str.replace(/(^/s*)/g, ""); // 去掉左空格
str.replace(/(/s*$)/g, ""); // 去掉右空格
arr=["1","1","1","1"];
str=arr.join(","); //str=1,1,1,1
str="1,1,1,1";
arr=str.split(","); //["1","1","1","1"];
标签:
原文地址:http://www.cnblogs.com/sweetyu/p/5310534.html