How do you remove special characters in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you remove special characters in java

how do you remove special characters in a java string because this does not work replaceAll("\\W", "")

28th May 2018, 1:44 PM
Aiden Brody
Aiden Brody - avatar
2 Answers
+ 2
Are you sure the correct Object Type and variable has been declared before the method? If you just use replaceAll(); it won't work. You have to tell it what type and variable to replaceAll with. https://stackoverflow.com/questions/7552253/how-to-remove-special-characters-from-a-string
28th May 2018, 5:48 PM
Apple Blossom
Apple Blossom - avatar
0
Thank you your information was helpful
30th May 2018, 9:26 AM
Aiden Brody
Aiden Brody - avatar