Replaces all characters in the second parameter found in the first
parameter with the final character.
@param value the string to replace characters in
@param chars the characters to replace
@param replacement the character to insert as replacement
351084
public static String replaceAnyOf(String value, String chars,
                                    char replacement) {
    char[] tmp = new char[value.length()];
    int pos = 0;
    for (int ix = 0; ix < tmp.length; ix++) {
      char ch = value.charAt(ix);
      if (chars.indexOf(ch) != -1)
        tmp[pos++] = replacement;
      else
        tmp[pos++] = ch;
    }
    return new String(tmp, 0, tmp.length);
  }
381315
public void replace(CharSequence text, Appendable out) throws IOException
    {
        int idx = CharSequences.indexOf(text, "${");
        if (idx != -1)
        {
            out.append(text.subSequence(0, idx));
            int end = findEnd(text, idx+2);
            String key = replace(text.subSequence(idx+2, end));
            out.append(map(key));
            out.append(replace(text.subSequence(end+1, text.length())));
            
        }
        else
        {
            out.append(text);
        }
    }
1173090
protected void replaceValue(Map<String, Object> content, String key, Object value) {
		if (content.containsKey(key) && value != null) {
			content.put(key, value);
		}
	}
1375006
public String replace(String str, String regex, String replace) {
		if (str == null)
			return "";
		if (regex == null)
			return str;
		if(replace == null) replace = "";
		return str.replaceAll(regex, replace);
	}
866444
private String setParamsters(String value, final Object[] params) {
		for (int i = 0; i < params.length; i++) {
			value = value.replaceAll("\\{" + i + "\\}", params[i].toString());
		}
		return value;
	}
578014
public static void replace(final String string, final String find, final String replacement, final Appendable out) throws IOException {
		int pos = string.indexOf(find);
		//System.out.println(string+": "+find+" at "+pos);
		if (pos == -1) {
			out.append(string);
		} else {
			int lastpos = 0;
			final int findLen = find.length();
			do {
				out.append(string, lastpos, pos).append(replacement);
				lastpos = pos + findLen;
				pos = string.indexOf(find, lastpos);
			} while (pos != -1);
			int len = string.length();
			if(lastpos<len) out.append(string, lastpos, len);
		}
	}
906240
public void replaceValues(List<Object> values) {
    Preconditions.checkArgument(values != null, "Values cannot be null");
    Preconditions.checkArgument(values.size() <= fields.size(), "Values cannot be larger than fields size");
    this.values = values;
  }
255827
public static String replace(final CharSequence target, final CharSequence replacement, final String string) {
    return Pattern.compile(quote(target.toString())/*
                                                    * , Pattern.LITERAL jdk 1.4
                                                    */).matcher(string).replaceAll(
    /* Matcher. jdk 1.4 */quoteReplacement(replacement.toString()));
  }
1125035
public static String escape(String value, char quote) {
    Map<CharSequence, CharSequence> lookupMap = new HashMap<>();
    lookupMap.put(Character.toString(quote), "\\" + quote);
    lookupMap.put("\\", "\\\\");

    final CharSequenceTranslator escape =
        new LookupTranslator(lookupMap)
                .with(new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE))
                .with(JavaUnicodeEscaper.outsideOf(32, 0x7f));

    return quote + escape.translate(value) + quote;
  }
1130320
public void overrideSetting(String name, char value) {
        overrides.put(name, Character.toString(value));
    }
34452
public static String replaceDoubleSingleQuotes( String value )
	{
		int idx = value.indexOf("''");
		if (idx == -1)
			return value;
		
		int len = value.length();
		int pos = 0;
		StringBuilder sb = new StringBuilder(len);
		while (idx != -1)
		{
			if (idx > pos)
			{
				sb.append(value.substring(pos, idx));
				pos += (idx-pos);
			}
			
			sb.append("'");	
			pos+=2;
			
			idx = value.indexOf("''",pos);
		}
		if (pos < len)
			sb.append(value.substring(pos, len));
			
		return sb.toString();
	}
555076
public String replaceAllInWith(String regEx, String value, String replace) {
        String result = null;
        if (value != null) {
            if (replace == null) {
                // empty cell in table is sent as null
                replace = "";
            }
            result = getMatcher(regEx, value).replaceAll(replace);
        }
        return result;
    }
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;
    }
859344
private void replaceCommandLine(String replacement) {
		int currentCLSize = commandLineBuffer.size();
		commandLineBuffer = new ByteArrayOutputStream();
		for (int x = 0; x < replacement.length(); x++) {
			commandLineBuffer.write(replacement.charAt(x));
		}
		String replaceString = '\r' + promptStr;
		for (int x = 0; x <= currentCLSize; x++) {
			replaceString += ' ';
		}
		replaceString += '\r' + promptStr + replacement;
		ps.print(replaceString);
	}
1342306
public static String replace(String str, String regex, String... args) {
		int length = args.length;
		for (int i = 0; i < length; i++) {
			str = str.replaceFirst(regex, args[i]);
		}
		return str;
	}
1362219
def _perform_replacements(self, chars):
        '''
        
        '''
        for n in range(len(chars)):
            char = chars[n]
            if char in repl:
                chars[n] = repl[char]

        # Some replacements might result in multi-character strings
        # being inserted into the list. Ensure we still have a list
        # of single characters for iteration.
        return list(''.join(chars))
647035
public void replaceValue(List<CmsDataViewValue> replacementValues) {

        CmsAttributeHandler handler = (CmsAttributeHandler)m_handler;
        Element parent = CmsDomUtil.getAncestor(
            m_widget.getElement(),
            I_CmsLayoutBundle.INSTANCE.form().attributeValue()).getParentElement();
        NodeList<Node> siblings = parent.getChildNodes();
        for (int j = 0; j < siblings.getLength(); j++) {
            Node node = siblings.getItem(j);
            if (node instanceof Element) {
                Element elem = (Element)node;
                if (elem.isOrHasChild(m_widget.getElement())) {
                    m_index = j;
                    break;
                }
            }
        }
        Panel container = handler.removeAttributeValueAndReturnPrevParent(m_index, true);
        int i = m_index;
        for (CmsDataViewValue value : replacementValues) {
            CmsEntity entity = CmsEntityBackend.getInstance().createEntity(null, m_entity.getTypeName());

            writeValueToEntity(value, entity);

            // handler.addNewAttributeValue(entity);
            handler.insertNewAttributeValue(entity, i, container);
            i += 1;
        }

        handler.updateButtonVisisbility();
    }