protected final boolean matchString(int state, char expected[]) throws Exception{
        int length = expected.length;

        while(state<length && position<limit){
            if(input[position]!=expected[state])
                throw expected(codePoint(), new String(new int[]{ Character.codePointAt(expected, state) }, 0, 1));
            state++;
            position++;
        }
        if(state==length)
            return true;
        else{
            if(marker==EOF)
                throw expected(EOF, new String(expected, state, length-state));
            exiting(RULE_DYNAMIC_STRING_MATCH, state);
            return false;
        }
    }
protected final boolean matchString ( int state , char expected [ ] ) throws Exception { int length = expected . length ; while ( state < length && position < limit ) { if ( input [ position ] != expected [ state ] ) throw expected ( codePoint ( ) , new String ( new int [ ] { Character . codePointAt ( expected , state ) } , 0 , 1 ) ) ; state ++ ; position ++ ; } if ( state == length ) return true ; else { if ( marker == EOF ) throw expected ( EOF , new String ( expected , state , length - state ) ) ; exiting ( RULE_DYNAMIC_STRING_MATCH , state ) ; return false ; } }
NOTE: use only when bufferring is off and no new lines in expected