String abc=folderDocBean.getService().replaceAll("\\s+", "_");
abc = hello world (English)
or hello world ((((English
expected output:- hello_world_English
In the above line it removes white spaces and ads _
in the place of whitespace..
I want to remove the braces if matching braces ()
exists then all braces the braces need to remove.
I have tried with abc.replaceAll("\\p{P}","");
is removing the braces but not ading any underscore to my string
abc = abc.replaceAll("\\s+", "_");
abc = abc.replaceAll("[\\(\\)\\[\\]\\{\\}]",""); ==> it is satisfying my reqirement and how can I write the same in a single statement