private static boolean matchBracketClass(char c, StringPointer pp, StringPointer ecc) {
        StringPointer p = pp.getClone();
        StringPointer ec = ecc.getClone();
        boolean sig = true;
        if (p.getChar(1) == '^') {
            sig = false;
            p.postIncrString(1);  // skip the `^'
        }
        while (p.preIncrStringI(1) < ec.getIndex()) {
            if (p.getChar() == L_ESC) {
                p.postIncrString(1);
                if (matchClass(p.getChar(), c)) {
                    return sig;
                }
            } else if ((p.getChar(1) == '-') && (p.getIndex() + 2 < ec.getIndex())) {
                p.postIncrString(2);
                if (p.getChar(-2) <= c && c <= p.getChar()) {
                    return sig;
                }
            } else if (p.getChar () == c) {
                return sig;
            }
        }
        return !sig;
    }
Only works with non-negative numbers
main/src/main/java/cgeo/geocaching/wherigo/kahlua/stdlib/StringLib.java