I have a String which contains some special characters and white spaces as well. I want to remove white spaces and special character. I am doing it as:
String str = "45,%$^ Sharma%$&^,is,46&* a$# Java#$43 Developer$#$^ in#$^ CST&^* web*&(,but he%^&^% wants to move@!$@# to another team";
System.out.println(str.replaceAll("[^a-zA-Z]", " ").replaceAll("\\s+", " "));
Output:
sharma is a Java Developer in CST web but he wants to move to another team
Can I do this using single operation? How?