public class test {
public static void main(String[] args) {
String a = "so many, punctuations , haha!";
a.replaceAll("[\\p{Punct}]+", "");
System.out.print(a);
}
}
I try this method, but the punctuation in a is still there, I don't understand why.
The replaceAll() function didn't work.
You need to do this:
a = a.replaceAll("[\\p{Punct}]+", "");