Sets the character at the index. @param index the zero-based index of the character to replace. @param ch the character to set. @throws IndexOutOfBoundsException if index is negative or greater than or equal to the current {@link #length
(int index, char ch)
| 516 | * current {@link #length()}. |
| 517 | */ |
| 518 | public void setCharAt(int index, char ch) { |
| 519 | if (0 > index || index >= count) { |
| 520 | throw new StringIndexOutOfBoundsException(index); |
| 521 | } |
| 522 | if (shared) { |
| 523 | value = value.clone(); |
| 524 | shared = false; |
| 525 | } |
| 526 | value[index] = ch; |
| 527 | } |
| 528 | |
| 529 | /** |
| 530 | * Sets the current length to a new value. If the new length is larger than |