If the string is fairly small, one option you have is to use regular expressions. String.replaceAll accepts a regular expression and a replacement string. So you could try something like
yourString=yourString.replaceAll("style=\\".+?\\"", "");
yourString=yourString.replaceAll("class=\\".+?\\"", "");
Try http://gskinner.com/RegExr/ It has a great regular expression builder asnd evaluator on a sample string.