/** Replaces the specified subsequence in this builder with the specified string. * * @param start the inclusive begin index. * @param end the exclusive end index. * @param str the replacement string. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code start} is negative, greater than the current {@code length()} or greater * than {@code end}. * @throws NullPointerException if {@code str} is {@code null}. */ public StringBuilder replace (int start, int end, String str) { replace0(start, end, str); return this; }
/** Replaces the specified subsequence in this builder with the specified string. * * @param start the inclusive begin index. * @param end the exclusive end index. * @param str the replacement string. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code start} is negative, greater than the current {@code length()} or greater * than {@code end}. * @throws NullPointerException if {@code str} is {@code null}. */ public StringBuilder replace (int start, int end, String str) { replace0(start, end, str); return this; }
/** Replaces all instances of {@code find} with {@code replace}. */ public StringBuilder replace (char find, String replace) { int replaceLength = replace.length(); int index = 0; while (true) { while (true) { if (index == length) return this; if (chars[index] == find) break; index++; } replace0(index, index + 1, replace); index += replaceLength; } }
/** Replaces all instances of {@code find} with {@code replace}. */ public StringBuilder replace (char find, String replace) { int replaceLength = replace.length(); int index = 0; while (true) { while (true) { if (index == length) return this; if (chars[index] == find) break; index++; } replace0(index, index + 1, replace); index += replaceLength; } }
/** Replaces all instances of {@code find} with {@code replace}. */ public StringBuilder replace (String find, String replace) { int findLength = find.length(), replaceLength = replace.length(); int index = 0; while (true) { index = indexOf(find, index); if (index == -1) break; replace0(index, index + findLength, replace); index += replaceLength; } return this; }
/** Replaces all instances of {@code find} with {@code replace}. */ public StringBuilder replace (String find, String replace) { int findLength = find.length(), replaceLength = replace.length(); int index = 0; while (true) { index = indexOf(find, index); if (index == -1) break; replace0(index, index + findLength, replace); index += replaceLength; } return this; }
/** Replaces the specified subsequence in this builder with the specified string. * * @param start the inclusive begin index. * @param end the exclusive end index. * @param str the replacement string. * @return this builder. * @throws StringIndexOutOfBoundsException if {@code start} is negative, greater than the current {@code length()} or greater * than {@code end}. * @throws NullPointerException if {@code str} is {@code null}. */ public StringBuilder replace (int start, int end, String str) { replace0(start, end, str); return this; }
/** Replaces all instances of {@code find} with {@code replace}. */ public StringBuilder replace (char find, String replace) { int replaceLength = replace.length(); int index = 0; while (true) { while (true) { if (index == length) return this; if (chars[index] == find) break; index++; } replace0(index, index + 1, replace); index += replaceLength; } }
/** Replaces all instances of {@code find} with {@code replace}. */ public StringBuilder replace (String find, String replace) { int findLength = find.length(), replaceLength = replace.length(); int index = 0; while (true) { index = indexOf(find, index); if (index == -1) break; replace0(index, index + findLength, replace); index += replaceLength; } return this; }