StringBuilder (String word, StringBuilder out) { for (int i = 0, length = word.length(); i < length; ++i) { if (isRegExpMetaChar(word.charAt(i))) { out.append("\\"); } out.append(word.charAt(i)); } return out; }