Inserts a subsequence of the specified CharSequence
into
this sequence.
The subsequence of the argument s
specified by
start
and end
are inserted,
in order, into this sequence at the specified destination offset, moving
up any characters originally above that position. The length of this
sequence is increased by end - start
.
The character at index k in this sequence becomes equal to:
dstOffset
+start-dstOffset
in
the argument s
, if k is greater than or equal to
dstOffset
but is less than dstOffset+end-start
-(end-start)
in this
sequence, if k is greater than or equal to
dstOffset+end-start
The dstOffset
argument must be greater than or equal to
0
, and less than or equal to the length
of this sequence.
The start argument must be nonnegative, and not greater than
end
.
The end argument must be greater than or equal to
start
, and less than or equal to the length of s.
If s
is null
, then this method inserts
characters as if the s parameter was a sequence containing the four
characters "null"
.
dstOffset | the offset in this sequence. | |
s | the sequence to be inserted. | |
start | the starting index of the subsequence to be inserted. | |
end | the end index of the subsequence to be inserted. |
IndexOutOfBoundsException | if dstOffset
is negative or greater than this.length() , or
start or end are negative, or
start is greater than end or
end is greater than s.length() |
Diagram: String