public class Main
{
public static void main(String[] args) {
String str = "[This is a] [Test String]";
System.out.println("String with square brackets: " + str);
str = str.replaceAll("\\[", "").replaceAll("\\]","");
System.out.println("String after square brackets: " + str);
}
} |
public class Main
{
public static void main(String[] args) {
String str = "[This is a] [Test String]";
System.out.println("String with square brackets: " + str);
str = str.replaceAll("\\[", "").replaceAll("\\]","");
System.out.println("String after square brackets: " + str);
}
}
Output:
String with square brackets: [This is a] [Test String]
String after square brackets: This is a Test String |
String with square brackets: [This is a] [Test String]
String after square brackets: This is a Test String