change endOffset to be one beyond the last base

change definition of endOffset so that endOffset-startOffset is length (if all within one block)
and you can iterate while (i < endOffset).  This is natural in 0-based coordinate systems, 
avoiding +1 or -1 calculations on lengths.