String (final String textToMarkup, final String filter) { StringBuilder cur = new StringBuilder(); final String s = Strings.toLowerCase(textToMarkup); for (String part : filter.split(" ")) { if (s.contains(part)) { cur.append("\"").append(part).append("\" "); } else { cur.append(part).append(" "); } } return cur.toString(); }