arrays - Matching words in a list against a stringarray in java -
i need find , replace list of words given user. application reads line line in html file , want verify if there word list , replace blank space. have until think have modify hole code in order want.
private static void printfile(file source) throws ioexception { string s; filereader fr = new filereader(source); @suppresswarnings("resource") bufferedreader br = new bufferedreader(fr); @suppresswarnings("resource") printwriter pw = new printwriter("results.txt"); while ((s=br.readline())!=null) { pw.println(s.replaceall(" ", "") //words replaced. .replaceall("<br>", "") .replaceall("&", "") .replaceall("</p>", "") .replaceall("</body>","") .replaceall("</html>", "") .replaceall("<remote object=\"#default\">>", "")); } system.out.println("done!"); }
i accept suggestions, list idea may not best option.
you can remove html markup simple jsoup:
public static string html2text(string html) { return jsoup.parse(html).text(); }
also have @ cleaner
, whitelist
sanatize documents individually.
Comments
Post a Comment