This example will show how to remove a character from a string using java, guava, apache commons and spring framework. This example could be used in conjunction with parsing a phone number if you need to remove all character references and convert to a number.
Straight up Java
Replace
This snippet will delete a character from a string using java's String.replace
Replace all
This snippet will use a regular expression to remove special characters from a String by calling String.replaceAll.
Google Guava
This snippet will use guava CharMatcher to define a range of characters and by calling retainFrom() will return a string containing all matching characters.
Apache Commons
This snippet will removes all occurrences of a character from a string using apache commons StringUtils.remove.
Spring Framework
Using springframework, this snippet will replace all instances of a String with a String in a String, whoo, say that 10 times fast, it was hard to write!