public static String deleteAny(String inString, @Nullable String charsToDelete) {
        if (!hasLength(inString) || !hasLength(charsToDelete)) {
            return inString;
        }

        int lastCharIndex = 0;
        char[] result = new char[inString.length()];
        for (int i = 0; i < inString.length(); i++) {
            char c = inString.charAt(i);
            if (charsToDelete.indexOf(c) == -1) {
                result[lastCharIndex++] = c;
            }
        }
        if (lastCharIndex == inString.length()) {
            return inString;
        }
        return new String(result, 0, lastCharIndex);
    }
Delete any character in a given {@code String}.

@param inString      the original {@code String}
@param charsToDelete a set of characters to delete.
                     E.g. "az\n" will delete 'a's, 'z's and new lines.
@return the resulting {@code String}
analyzer/src/main/java/nl/basjes/parse/useragent/utils/springframework/util/StringUtils.java