4 public class StringUtils
8 * Returns a new character array, after inserting characters into the given
12 * the character array to insert into
14 * the 0-based position for insertion
16 * the number of characters to insert
18 * the character to insert
20 public static final char[] insertCharAt(char[] in, int position,
24 char[] tmp = new char[in.length + count];
26 if (position >= in.length)
28 System.arraycopy(in, 0, tmp, 0, in.length);
33 System.arraycopy(in, 0, tmp, 0, position);
43 if (position < in.length)
45 System.arraycopy(in, position, tmp, index,
46 in.length - position);
60 public static final char[] deleteChars(char[] in, int from, int to)
62 if (from >= in.length)
72 System.arraycopy(in, 0, tmp, 0, from);
77 tmp = new char[in.length - to + from];
78 System.arraycopy(in, 0, tmp, 0, from);
79 System.arraycopy(in, to, tmp, from, in.length - to);
85 * Returns the last part of 'input' after the last occurrence of 'token'. For
86 * example to extract only the filename from a full path or URL.
90 * a delimiter which must be in regular expression format
93 public static String getLastToken(String input, String token)
103 String[] st = input.split(token);
104 return st[st.length - 1];