private static boolean replace(final StringBuilder input,
                                   final String from, final String to) {
        int start = input.indexOf(from);
        if (start == -1) {
            return false;
        }

        final int fromLength = from.length();
        final int toLength = to.length();
        while (start != -1) {
            input.replace(start, start + fromLength, to);
            start = input.indexOf(from, start + toLength);
        }
        return true;
    }
Format given HTML string so it is ready to be presented in a text view

@param html
@return formatted HTML
app/src/main/java/com/github/pockethub/android/util/HtmlUtils.java