public CharSequence subSequence(int start, int end) {int remaining = end - start;StringBuilder sb = new StringBuilder(remaining);int blockIdx = blockIndex(start);int indexInBlock = indexInBlock(start);while (remaining > 0) {Block b = blocks.get(blockIdx++);int numToAppend = Math.min(remaining, b.length - indexInBlock);sb.append(b.chars, indexInBlock, numToAppend);remaining -= numToAppend;indexInBlock = 0; }return sb.toString();}
public virtual ICharSequence Subsequence(int startIndex, int length){int remaining = length;StringBuilder sb = new StringBuilder(remaining);int blockIdx = BlockIndex(startIndex);int indexInBlock = IndexInBlock(startIndex);while (remaining > 0){Block b = blocks[blockIdx++];int numToAppend = Math.Min(remaining, b.length - indexInBlock);sb.Append(b.chars, indexInBlock, numToAppend);remaining -= numToAppend;indexInBlock = 0; }return new StringBuilderCharSequence(sb);}