Removing Double Quotes from a String in Java [Closed]

How would I remove double quotes from a String?

For example: I would expect "abd to produce abd, without the double quote.

Here's the code I've tried:

line1 = line1.replaceAll("\"(\\b[^\"]+|\\s+)?\"(\\b[^\"]+\\b)?\"([^\"]+\\b|\\s+)?\"","\"$1$2$3\"");
2

You can just go for String replace method.-

line1 = line1.replace("\"", "");
2

Use replace method of string like the following way:

String x="\"abcd";
String z=x.replace("\"", "");
System.out.println(z);

Output:

abcd
String withoutQuotes_line1 = line1.replace("\"", "");

have a look here

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest