public String consumeTo ( String seq ) { int offset = queue . indexOf ( seq , pos ) ; if ( offset != - 1 ) { String consumed = queue . substring ( pos , offset ) ; pos += consumed . length ( ) ; return consumed ; } else { return remainder ( ) ; } }
Pulls a string off the queue up to but exclusive of the match sequence or to the queue running out .