/** * @author lautturi.com * Java example: how to remove the start and end double quote in a string */ import java.util.*; import java.util.regex.*; public class Lautturi { public static void main(String[] args) { String str = "\"welcome to lauttur! java world!\""; String newStr = str.replaceAll("^\"|\"$", ""); // remove start and end double quote in a string // String newStr = str.replaceAll("\"", "");// java remove all double quote in a string System.out.println(str); System.out.println(newStr); } }
output:
"welcome to lauttur! java world!" welcome to lauttur! java world!