public static String jQuoteOrName()

in freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/TextUtil.java [81:116]


    public static String jQuoteOrName(char c) {
        if (c == '\\' || c == '\''  || c == '"' || c < 0x20) {
            switch (c) {
            case '\\':
                return "'\\\\'";
            case '\'':
                return "\"apostrophe-quote\"";
            case '"':
                return "\"quotation mark\"";
            case '\n':
                return "'\\n'";
            case '\r':
                return "'\\r'";
            case '\t':
                return "'\\t'";
            case '\b':
                return "'\\b'";
            case '\f':
                return "'\\f'";
            default:
                String s = Integer.toHexString(c);
                int ln = s.length();
                if (ln == 1) {
                    return "'\\u000" + s + "'";
                } else if (ln == 2) {
                    return "'\\u00" + s + "'";
                } else if (ln == 3) {
                    return "'\\u0" + s + "'";
                } else {
                    return "'\\u" + s + "'";
                }
            }
        } else {
            return "'" + c + "'";
        }
    }