str为“123”
如果一个双引号:
str1 = str.replace("\"","").replace("\"","");
如果不确定有多少个双引号:
str2 = str.replace(/\"/g, "");
此方法为替换,也可用于去除制定字符,如:
var str = "12/3";
str1 = str.replace("\/","");
str2 = str.replace(/\//g, "");
输出为:
str1 = 123
str2 = 123