Copies this string replacing occurrences of the specified character with another character.

@param oldChar the character to replace.
@param newChar the replacement character.
@return a new string with occurrences of oldChar replaced by newChar.
324713
public AsciiString replace(char oldChar, char newChar) {
        if (oldChar > MAX_CHAR_VALUE) {
            return this;
        }

        final byte oldCharAsByte = c2b0(oldChar);
        final byte newCharAsByte = c2b(newChar);
        final int len = offset + length;
        for (int i = offset; i < len; ++i) {
            if (value[i] == oldCharAsByte) {
                byte[] buffer = PlatformDependent.allocateUninitializedArray(length());
                System.arraycopy(value, offset, buffer, 0, i - offset);
                buffer[i - offset] = newCharAsByte;
                ++i;
                for (; i < len; ++i) {
                    byte oldValue = value[i];
                    buffer[i - offset] = oldValue != oldCharAsByte ? oldValue : newCharAsByte;
                }
                return new AsciiString(buffer, false);
            }
        }
        return this;
    }
876276
@Override
    protected String escapeCharacter(char ch, char previousChar) {
        Character key = Character.valueOf(ch);
        String replacement = replacements.get(key);
        if (replacement == null) {
            replacement = StreamingHTMLEncoderHelper.convertToReference(ch);
            replacements.put(key, replacement != null ? replacement : NULL_MARKER);
        }
        return replacement != NULL_MARKER ? replacement : null;
    }
1161006
public static String dupString(char c, int nCopies) {
        char[] chars = new char[nCopies];
        Arrays.fill(chars, c);
        return new String(chars);
    }
1254429
public void replaceChars(int startPosition, int endPosition, String replacement) {
    try {
      sourceBuilder.replace(startPosition, endPosition, replacement);
    } catch (StringIndexOutOfBoundsException e) {
      throw new IndexOutOfBoundsException(
          String.format(
              "Replacement cannot be made. Source file %s has length %d, requested start "
                  + "position %d, requested end position %d, replacement %s",
              path, sourceBuilder.length(), startPosition, endPosition, replacement));
    }
  }
226619
public String replace(CharSequence text)
    {
        StringBuilder sb = new StringBuilder();
        replace(sb, text);
        return sb.toString();
    }
1258405
public void addString(String str) {
        if (mSize == mStrings.length) {
            String[] old = mStrings;
            int oldSize = old.length;
            mStrings = new String[oldSize + (oldSize << 1)];
            System.arraycopy(old, 0, mStrings, 0, oldSize);
        }
        mStrings[mSize++] = str;
    }
550035
public String replaceString(String string, String strTarget, String strReplace)
    {
        int iIndex = 0;
        while ((iIndex = string.indexOf(strTarget, iIndex)) != -1)
        {
            char chNext = ' ';
            char chPrev = ' ';
            if (string.length() > iIndex + strTarget.length())
                chNext = string.charAt(iIndex + strTarget.length());
            if (iIndex > 1)
                chPrev = string.charAt(iIndex - 1);
            if (COMPARE_ANY_STRING)
            {   // Compare any string, not just names
                chNext = '.';
                chPrev = '.';
            }
            if (Character.isLetterOrDigit(chNext))
            { // Alphanumeric = longer than target.. don't change
                iIndex = iIndex + strTarget.length();
            }
            else if (Character.isLetterOrDigit(chPrev))
            { // Alphanumeric = longer than target.. don't change
                iIndex = iIndex + strTarget.length();
            }
            else
            { // space/other = end of char.. change
                string = string.substring(0, iIndex) + strReplace + string.substring(iIndex + strTarget.length());
                iIndex = iIndex + strReplace.length();
System.out.println("New String " + string);
            }
        }
        return string;
    }
62572
def copyChar(len, out, val):
    
    ret = libxml2mod.xmlCopyChar(len, out, val)
    return ret
473191
public static ByteBuf copiedBuffer(CharSequence string, Charset charset) {
        if (string == null) {
            throw new NullPointerException("string");
        }

        if (string instanceof CharBuffer) {
            return copiedBuffer((CharBuffer) string, charset);
        }

        return copiedBuffer(CharBuffer.wrap(string), charset);
    }
1155464
public Response<String> rename(final String oldkey, final String newkey) {
        writeAsync(newkey, () -> shadowPipeline.rename(oldkey, newkey));

        return DynoDualWriterPipeline.super.rename(oldkey,newkey);
    }
653168
static String fastReplace( String str, String target, String replacement ) {
        int targetLength = target.length();
        if( targetLength == 0 ) {
            return str;
        }
        int idx2 = str.indexOf( target );
        if( idx2 < 0 ) {
            return str;
        }
        StringBuilder buffer = new StringBuilder( targetLength > replacement.length() ? str.length() : str.length() * 2 );
        int idx1 = 0;
        do {
            buffer.append( str, idx1, idx2 );
            buffer.append( replacement );
            idx1 = idx2 + targetLength;
            idx2 = str.indexOf( target, idx1 );
        } while( idx2 > 0 );
        buffer.append( str, idx1, str.length() );
        return buffer.toString();
    }
53134
public void replace(XElement oldChild, XElement newChild) {
        int idx = children.indexOf(oldChild);
        if (idx >= 0) {
            children.get(idx).parent = null;
            children.set(idx, newChild);
            newChild.parent = this;
        }
    }
1188732
public static String replace(String string, String oldString, String newString) {
        return checkNull(string).replace(oldString, newString);
    }
602741
public final String replaceAll(String s, char replacementCharacter) {
    final StringBuilder sb = new StringBuilder();

    for (int offset = 0; offset < s.length(); ) {
      final int codePoint = s.codePointAt(offset);
      if (matches(codePoint)) {
        sb.append(replacementCharacter);
      } else {
        sb.appendCodePoint(codePoint);
      }
      offset += Character.charCount(codePoint);
    }

    return sb.toString();
  }
1170608
public String letterify(String letterString, char from, char to) {
		return replaceSymbolWithCharsFromTo(letterString, '?', from, to);
	}
327813
private static String replaceCharAt(String s, int pos, char c) {
		return s.substring(0, pos) + c + s.substring(pos + 1);
	}
694580
public int setReplacement(byte[] str, int p, int len, byte[] encname) {
        byte[] encname2 = encodingToInsertOutput();

        final byte[] str2;
        final int p2 = 0;
        final int len2;

        if (encname2.length == 0 || caseInsensitiveEquals(encname, encname2)) {
            str2 = new byte[len];
            System.arraycopy(str, p, str2, 0, len); // ??
            len2 = len;
            encname2 = encname;
        } else {
            Ptr len2p = new Ptr();
            str2 = allocateConvertedString(encname, encname2, str, p, len, null, len2p);
            if (str2 == null) return -1;
            len2 = len2p.p;
        }

        replacementString = str2;
        replacementLength = len2;
        replacementEncoding = encname2;
        return 0;
    }