Java字符串去掉双引号的有哪些方法
Java字符串去掉双引号的方法可使用replaceAll()方法还是substring()方法。
方法一:使用replaceAll()方法
String str = ""Hello World"";
str = str.replaceAll(""", "");
System.out.println(str);
输出结果为:Hello World
方法二:使用substring()方法
String str = ""Hello World"";
str = str.substring(1, str.length() - 1);
System.out.println(str);
输出结果为:Hello World
TOP