How would I remove all square brackets ("[]") from a given String in Java?
String s = "[abcdefg]"; s = s.replaceAll(regex, "");
What regular expression would be used in this case?
Use this one:
String s = "[abcdefg]"; String regex = "\[|\]"; s = s.replaceAll(regex, ""); System.out.println(s);
1.4m articles
1.4m replys
5 comments
57.0k users