Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Inserts str into myLine at position index;
- * no characters from myLine are overwritten.
- * @param str the strng to be inserted
- * @param index the position at which to insert str
- * Preconidtion: 0 <= index <= myLine.length()
- */
- public void insert(final String str, final int index) {
- if (0 <= index && index <= myLine.length()) {
- String begin = myLine.substring(0, index);
- String end = myLine.substring(index);
- myLine = begin + end;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement