去除字符串中的双引号

来源:互联网 发布:域名跳转服务 编辑:程序博客网 时间:2024/05/23 16:59
str为“123

如果一个双引号:

str1 = str.replace("\"","").replace("\"","");

如果不确定有多少个双引号:

str2 = str.replace(/\"/g, "");

此方法为替换,也可用于去除制定字符,如:

String str = "12/3";str1 = str.replace("\/","");str2 = str.replace(/\//g, "");输出为: str1 = 123str2 = 123
0 0