public StrBuilder insert ( final int index , final char chars [ ] , final int offset , final int length ) { validateIndex ( index ) ; if ( chars == null ) { return insert ( index , nullText ) ; } if ( offset < 0 || offset > chars . length ) { throw new StringIndexOutOfBoundsException ( "Invalid offset: " + offset ) ; } if ( length < 0 || offset + length > chars . length ) { throw new StringIndexOutOfBoundsException ( "Invalid length: " + length ) ; } if ( length > 0 ) { ensureCapacity ( size + length ) ; System . arraycopy ( buffer , index , buffer , index + length , size - index ) ; System . arraycopy ( chars , offset , buffer , index , length ) ; size += length ; } return this ; }
Inserts part of the character array into this builder . Inserting null will use the stored null text value .