/** Inserts the specified string at the specified {@code offset}. If the specified string is null, then the String * {@code "null"} is inserted. * * @param offset the index to insert at. * @param str the {@code String} to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. */ public StringBuilder insert (int offset, String str) { insert0(offset, str); return this; }
/** Inserts the string representation of the specified {@code boolean} value at the specified {@code offset}. The * {@code boolean} value is converted to a string according to the rule defined by {@link String#valueOf(boolean)}. * * @param offset the index to insert at. * @param b the {@code boolean} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length}. * @see String#valueOf(boolean) */ public StringBuilder insert (int offset, boolean b) { insert0(offset, b ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ return this; }
/** Inserts the string representation of the specified {@code boolean} value at the specified {@code offset}. The * {@code boolean} value is converted to a string according to the rule defined by {@link String#valueOf(boolean)}. * * @param offset the index to insert at. * @param b the {@code boolean} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length}. * @see String#valueOf(boolean) */ public StringBuilder insert (int offset, boolean b) { insert0(offset, b ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ return this; }
/** Inserts the string representation of the specified {@code char[]} at the specified {@code offset}. The {@code char[]} value * is converted to a String according to the rule defined by {@link String#valueOf(char[])}. * * @param offset the index to insert at. * @param ch the {@code char[]} to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(char[]) */ public StringBuilder insert (int offset, char[] ch) { insert0(offset, ch); return this; }
/** Inserts the string representation of the specified {@code char} value at the specified {@code offset}. The {@code char} * value is converted to a string according to the rule defined by {@link String#valueOf(char)}. * * @param offset the index to insert at. * @param c the {@code char} value to insert. * @return this builder. * @throws IndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(char) */ public StringBuilder insert (int offset, char c) { insert0(offset, c); return this; }
/** Inserts the specified string at the specified {@code offset}. If the specified string is null, then the String * {@code "null"} is inserted. * * @param offset the index to insert at. * @param str the {@code String} to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. */ public StringBuilder insert (int offset, String str) { insert0(offset, str); return this; }
/** Inserts the string representation of the specified {@code char[]} at the specified {@code offset}. The {@code char[]} value * is converted to a String according to the rule defined by {@link String#valueOf(char[])}. * * @param offset the index to insert at. * @param ch the {@code char[]} to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(char[]) */ public StringBuilder insert (int offset, char[] ch) { insert0(offset, ch); return this; }
/** Inserts the string representation of the specified {@code int} value at the specified {@code offset}. The {@code int} value * is converted to a String according to the rule defined by {@link String#valueOf(int)}. * * @param offset the index to insert at. * @param i the {@code int} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(int) */ public StringBuilder insert (int offset, int i) { insert0(offset, Integer.toString(i)); return this; }
/** Inserts the string representation of the specified {@code int} value at the specified {@code offset}. The {@code int} value * is converted to a String according to the rule defined by {@link String#valueOf(int)}. * * @param offset the index to insert at. * @param i the {@code int} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(int) */ public StringBuilder insert (int offset, int i) { insert0(offset, Integer.toString(i)); return this; }
/** Inserts the string representation of the specified {@code long} value at the specified {@code offset}. The {@code long} * value is converted to a String according to the rule defined by {@link String#valueOf(long)}. * * @param offset the index to insert at. * @param l the {@code long} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {code length()}. * @see String#valueOf(long) */ public StringBuilder insert (int offset, long l) { insert0(offset, Long.toString(l)); return this; }
/** Inserts the string representation of the specified {@code CharSequence} at the specified {@code offset}. The * {@code CharSequence} is converted to a String as defined by {@link CharSequence#toString()}. If {@code s} is {@code null}, * then the String {@code "null"} is inserted. * * @param offset the index to insert at. * @param s the {@code CharSequence} to insert. * @return this builder. * @throws IndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see CharSequence#toString() */ public StringBuilder insert (int offset, CharSequence s) { insert0(offset, s == null ? "null" : s.toString()); //$NON-NLS-1$ return this; }
/** Inserts the string representation of the specified {@code float} value at the specified {@code offset}. The {@code float} * value is converted to a string according to the rule defined by {@link String#valueOf(float)}. * * @param offset the index to insert at. * @param f the {@code float} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(float) */ public StringBuilder insert (int offset, float f) { insert0(offset, Float.toString(f)); return this; }
/** Inserts the string representation of the specified {@code double} value at the specified {@code offset}. The {@code double} * value is converted to a String according to the rule defined by {@link String#valueOf(double)}. * * @param offset the index to insert at. * @param d the {@code double} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(double) */ public StringBuilder insert (int offset, double d) { insert0(offset, Double.toString(d)); return this; }
/** Inserts the string representation of the specified {@code double} value at the specified {@code offset}. The {@code double} * value is converted to a String according to the rule defined by {@link String#valueOf(double)}. * * @param offset the index to insert at. * @param d the {@code double} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(double) */ public StringBuilder insert (int offset, double d) { insert0(offset, Double.toString(d)); return this; }
/** Inserts the string representation of the specified {@code Object} at the specified {@code offset}. The {@code Object} value * is converted to a String according to the rule defined by {@link String#valueOf(Object)}. * * @param offset the index to insert at. * @param obj the {@code Object} to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(Object) */ public StringBuilder insert (int offset, Object obj) { insert0(offset, obj == null ? "null" : obj.toString()); //$NON-NLS-1$ return this; }
/** Inserts the string representation of the specified {@code long} value at the specified {@code offset}. The {@code long} * value is converted to a String according to the rule defined by {@link String#valueOf(long)}. * * @param offset the index to insert at. * @param l the {@code long} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {code length()}. * @see String#valueOf(long) */ public StringBuilder insert (int offset, long l) { insert0(offset, Long.toString(l)); return this; }
/** Inserts the string representation of the specified {@code Object} at the specified {@code offset}. The {@code Object} value * is converted to a String according to the rule defined by {@link String#valueOf(Object)}. * * @param offset the index to insert at. * @param obj the {@code Object} to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(Object) */ public StringBuilder insert (int offset, Object obj) { insert0(offset, obj == null ? "null" : obj.toString()); //$NON-NLS-1$ return this; }
/** Inserts the string representation of the specified {@code float} value at the specified {@code offset}. The {@code float} * value is converted to a string according to the rule defined by {@link String#valueOf(float)}. * * @param offset the index to insert at. * @param f the {@code float} value to insert. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}. * @see String#valueOf(float) */ public StringBuilder insert (int offset, float f) { insert0(offset, Float.toString(f)); return this; }
final void insert0 (int index, CharSequence s, int start, int end) { if (s == null) { s = "null"; } if (index < 0 || index > length || start < 0 || end < 0 || start > end || end > s.length()) { throw new IndexOutOfBoundsException(); } insert0(index, s.subSequence(start, end).toString()); }
final void insert0 (int index, CharSequence s, int start, int end) { if (s == null) { s = "null"; } if (index < 0 || index > length || start < 0 || end < 0 || start > end || end > s.length()) { throw new IndexOutOfBoundsException(); } insert0(index, s.subSequence(start, end).toString()); }