在目标字符串中按定界符查找，将定界字符串中间的字符串的所有 replaceSrc 替换为 replaceDest。

@param source
源字符串
@param startStr
定界开始
@param endStr
定界结束
@param replaceSrc
要替换的字符串
@param replaceDest
替换成的字符串
@return 结果
482968
public static String replaceAllBetweenDelimiter(final String source, final String startStr, final String endStr, final String replaceSrc,
		final String replaceDest) {
		StringBuilder str = new StringBuilder(source);
		for (int procPointer = 0; procPointer >= 0;) {
			int start = str.indexOf(startStr, procPointer);
			int end = -1;
			if (start >= 0) {
				end = str.indexOf(endStr, start);
			}
			if (end < 0) {
				procPointer = -1;
			} else {
				String midStr = str.substring(start + startStr.length(), end).replaceAll(replaceSrc, replaceDest);
				str.replace(start + startStr.length(), end, midStr);
				procPointer = start + startStr.length() + midStr.length() + endStr.length();
			}
		}
		return str.toString();
	}
955562
function replaceSelectors(source, bareTokenList, getSubstitution){
  var target = new FastArray(new Array(source.length));
  var tokenList = new FastArray(bareTokenList);
  target.endCursor = 0;

  for (var i = source.length - 1; i >= 0; i--) {
    var token = tokenList.first();
    if (token && i === token.end) {
      var length = token.end - token.start;

      var substitution = getSubstitution(token);
      i -= length;

      for (var j = substitution.length - 1; j >= 0; j--) {
        target.push(substitution[j]);
      }
      tokenList.shift();
    } else {
      target.push(source[i]);
    }
  }

  return target;
}
1075206
public List<String> getStringEnclosedIn(String srcStr, String startToken, String endToken) {
        List<StrPosition> resultList = getStringEnclosedInWithDetails(srcStr, startToken, endToken);
        List<String> retList = new ArrayList<String>();
        for (StrPosition sp : resultList) {
            retList.add(sp.str);
        }
        return retList;
    }
903870
public static ByteBuffer copy(ByteBuffer src, int start, int end) {
		return copy(src, ByteBuffer.allocate(end - start));
	}
1064058
public static void replaceAll(StringBuffer haystack, String needle, String newNeedle, int interval) {
		if (needle == null) {
			throw new IllegalArgumentException("string to replace can not be empty");
		}
		int idx = haystack.indexOf(needle);
		int nextIdx = -1;
		int processedChunkSize = idx;
		int needleLength = needle.length();
		int newNeedleLength = newNeedle.length();
		while (idx != -1/* && idx < haystack.length()*/) {
			if (processedChunkSize >= interval) {
				haystack.replace(idx, idx + needleLength, newNeedle);
				nextIdx = haystack.indexOf(needle, idx + newNeedleLength);
				processedChunkSize = nextIdx - idx;//length of replacement is not included
				idx = nextIdx;
			}
			else {
				nextIdx = haystack.indexOf(needle, idx + newNeedleLength);
				processedChunkSize += nextIdx - idx;
				idx = nextIdx;
				if (newNeedleLength == 0) {
					return;
				}
			}
		}
	}
873012
static public byte[] byteSubstring(byte[] bytes, int start, int end) {

        byte[] rc = null;

        if (0 > start || start > bytes.length || start > end) {
            // invalid start position
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Invalid start position in byteSubstring: " + start);
            }
        } else if (0 > end || end > bytes.length) {
            // invalid end position
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Invalid end position in byteSubstring: " + end);
            }
        } else {
            // now pull the substring
            int len = end - start;
            rc = new byte[len];
            System.arraycopy(bytes, start, rc, 0, len);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "byteSubstring returning: [" + getEnglishString(rc) + "]");
        }
        return rc;
    }
1010670
public StrBuilder insert(int index, CharSequence csq, int start, int end) {
		if (csq == null) {
			csq = "null";
		}
		final int csqLen = csq.length();
		if (start > csqLen) {
			return this;
		}
		if (start < 0) {
			start = 0;
		}
		if (end > csqLen) {
			end = csqLen;
		}
		if (start >= end) {
			return this;
		}
		if (index < 0) {
			index = 0;
		}

		final int length = end - start;
		moveDataAfterIndex(index, length);
		for (int i = start, j = this.position; i < end; i++, j++) {
			value[j] = csq.charAt(i);
		}
		this.position = Math.max(this.position, index) + length;
		return this;
	}
142722
private String getReplaceChars(String replaceChar,int length){
		String resultReplace = replaceChar;
		for(int i = 1 ; i < length ; i++){
			resultReplace += replaceChar;
		}
		
		return resultReplace;
	}
686664
public StrBuilder replaceAll(final char search, final char replace) {
        if (search != replace) {
            for (int i = 0; i < size; i++) {
                if (buffer[i] == search) {
                    buffer[i] = replace;
                }
            }
        }
        return this;
    }
119692
protected String findPath(String start, String end) {
        if (start.equals(end)) {
            return start;
        } else {
            return findPath(start, parent.get(end)) + " -> " + end;
        }
    }
1168561
public static function substr_replace($str, $repl, $start, $length = null)
    {
        preg_match_all('/./us', $str, $ar);
        preg_match_all('/./us', $repl, $rar);
        if ($length === null) {
            $length = AnHelperString::strlen($str);
        }
        array_splice($ar[0], $start, $length, $rar[0]);
        return join('', $ar[0]);
    }
948703
@Override
    public FastStr replace(char oldChar, char newChar) {
        if (oldChar != newChar) {
            char[] val = this.buf; /* avoid getfield opcode */
            int len = length();
            int i = begin - 1;

            while (++i < end) {
                if (val[i] == oldChar) {
                    break;
                }
            }
            if (i < end) {
                char buf[] = new char[len];
                for (int j = begin; j < i; j++) {
                    buf[j - begin] = val[j];
                }
                while (i < end) {
                    char c = val[i];
                    buf[i - begin] = (c == oldChar) ? newChar : c;
                    i++;
                }
                return new FastStr(buf, 0, len);
            }
        }
        return this;
    }
10210
@Deprecated @ReplacedBy(value="java.lang.String.replace()", reason="since 1.5")
    public static String replace (String source, String before, String after)
    {
        int pos = source.indexOf(before);
        if (pos == -1) {
            return source;
        }

        StringBuilder sb = new StringBuilder(source.length() + 32);

        int blength = before.length();
        int start = 0;
        while (pos != -1) {
            sb.append(source.substring(start, pos));
            sb.append(after);
            start = pos + blength;
            pos = source.indexOf(before, start);
        }
        sb.append(source.substring(start));

        return sb.toString();
    }
944286
public static String replaceByMap(String _searchStr, Map<String, String> _replacements) {
        if (_searchStr == null) {
            return null;
        }
        if (_replacements == null || _replacements.isEmpty()) {
            return _searchStr;
        }

        String str = _searchStr;

        for (Entry<String, String> entry : _replacements.entrySet()) {
            str = str.replace(entry.getKey(), entry.getValue());
        }

        return str;
    }
165392
public static String replaceFullRequestContent(
            String requestContentTemplate, String replacementString) {
        return (requestContentTemplate.replace(
                PcConstants.COMMAND_VAR_DEFAULT_REQUEST_CONTENT,
                replacementString));
    }
1355017
public static String getStringAfter(final String src, final String toSearch, final int start) {
		final int ind = src.indexOf(toSearch, start);
		if (ind == -1)
			return "";
		return src.substring(ind + toSearch.length());
	}
746507
function replace(targetStr, searchStr, replaceStr, nPrev, nNext) {
  let result = targetStr;
  for (let i = 0; i < result.length; ++i) {
    if (result.substr(i, searchStr.length) === searchStr &&
      checkSubStr(result, i - nPrev.length, nPrev) === false &&
      checkSubStr(result, i + searchStr.length, nNext) === false) {
      result = result.slice(0, i) + replaceStr + result.slice(i + searchStr.length);
    }
  }
  return result;
}