3 public class StringUtils
7 * Returns a new character array, after inserting characters into the given
11 * the character array to insert into
13 * the 0-based position for insertion
15 * the number of characters to insert
17 * the character to insert
19 public static final char[] insertCharAt(char[] in, int position,
23 char[] tmp = new char[in.length + count];
25 if (position >= in.length)
27 System.arraycopy(in, 0, tmp, 0, in.length);
32 System.arraycopy(in, 0, tmp, 0, position);
42 if (position < in.length)
44 System.arraycopy(in, position, tmp, index,
45 in.length - position);
59 public static final char[] deleteChars(char[] in, int from, int to)
61 if (from >= in.length)
71 System.arraycopy(in, 0, tmp, 0, from);
76 tmp = new char[in.length - to + from];
77 System.arraycopy(in, 0, tmp, 0, from);
78 System.arraycopy(in, to, tmp, from, in.length - to);