For example I\'m extracting a text String from a text file and I need those words to form an array. However, when I do all that some words end with comma (,) or a full stop (.)
Use:
String str = "whatever"; str = str.replaceAll("[,.]", "");
replaceAll takes a regular expression. This:
[,.]
...looks for each comma and/or period.