return replaceEach(text, searchList, replacementList, false, 0);
return replaceEach(text, searchList, replacementList, true, timeToLive);
return replaceEach(result, searchList, replacementList, repeat, timeToLive - 1);
/** * @param text the reference from which to remove unneeded escapes * @return the cleaned text */ private String removeEscapesFromExtraParts(String text) { return StringUtils.replaceEach(text, ESCAPES_EXTRA, ESCAPE_REPLACEMENTS_EXTRA); }
/** * {@inheritDoc} */ public String clean(String uri) { return StringUtils.replaceEach(uri, searchList, replacementList); } }
/** * @param text the reference from which to remove unneeded escapes * @return the cleaned text */ private String removeEscapesFromReferencePart(String text) { return StringUtils.replaceEach(text, ESCAPES_REFERENCE, ESCAPE_REPLACEMENTS_REFERENCE); }
/** * Escapes a string for use in JavaScript. Replicates logic in {@link GeneralUtil#escapeForJavascript(String)} * which we shouldn't depend on in tests. */ public static String escapeString(String string) { final String[] matches = new String[]{"\\", "'", "\""}; final String[] replacements = new String[]{"\\\\", "\\'", "\\\""}; return StringUtils.replaceEach(string, matches, replacements); } }
private static String applyStandard(final String template) { final String applied = StringUtils.replaceEach(template, new String[] { "${newline}" }, new String[] { "\n" }); return applied; }
/** * @param text the query string and anchor parts to which to add escapes to * @return the modified text */ protected String addEscapesToExtraParts(String text) { return StringUtils.replaceEach(text, ESCAPES_EXTRA, ESCAPE_REPLACEMENTS_EXTRA); } }
/** * @param text the reference to which to add escapes to * @return the modified text */ protected String addEscapesToReferencePart(String text) { return StringUtils.replaceEach(text, ESCAPES_REFERENCE, ESCAPE_REPLACEMENTS_REFERENCE); }
/** * @param text the query string and anchor parts to which to add escapes to * @return the modified text */ protected String addEscapesToExtraParts(String text) { return StringUtils.replaceEach(text, ESCAPES_EXTRA, ESCAPE_REPLACEMENTS_EXTRA); } }
private void writeGraphEdge(String id, String source, String target, String label, OutputStream os) throws IOException { final String tag = StringUtils.replaceEach(GraphvizConstants.EDGE_STATEMENT, new String[] {"%NAME", "%ID", "%SOURCE", "%TARGET", "%LABEL"}, new String[] {graphVariableName, id, source, target, label}); IOUtils.write(tag, os); }
private void writeGraphNode(String id, String label, OutputStream os) throws IOException { final String tag = StringUtils.replaceEach(GexfConstants.NODE_TAG, new String[]{"%1", "%2"}, new String[]{id, label}); IOUtils.write(tag, os); }
public static String escape(String query) { StringBuilder sb = new StringBuilder(query.length()); for (char ch : query.toCharArray()) { if (isSpecialCharacter(ch)) { sb.append(ESCAPE_CHAR); } sb.append(ch); } String escapedQuery = sb.toString(); return StringUtils.replaceEach(escapedQuery, SPECIAL_CHAR_PAIR, SPECIAL_CHAR_PAIR_ESCAPED); }
protected Pattern createRemoteImportURLMatchingPattern(HttpReverseProxyPathMapper proxyMapper) { String remoteBaseURLPattern = StringUtils.replaceEach(StringUtils.removeEnd(proxyMapper.getRemoteBaseURL(), "/"), linkRemoteBaseURLSearches, linkRemoteBaseURLReplaces); return Pattern.compile("(\\s|^)(url)\\s*\\(\\s*(['\"])((" + remoteBaseURLPattern + ")([^'\"]*))['\"]\\)", Pattern.CASE_INSENSITIVE); }
public static String get() { final SortedMap<String, String> parameters = new TreeMap<>(); parameters.put(RELEASE_VERSION, new SystemInfoDataProvider().getReleaseVersion()); final Calendar now = Calendar.getInstance(); parameters.put(YEAR, String.valueOf(now.get(Calendar.YEAR))); parameters.put(MONTH, String.valueOf(now.get(Calendar.MONTH) + 1)); parameters.put(DAY, String.valueOf(now.get(Calendar.DAY_OF_MONTH))); final String[] search = parameters.keySet().toArray(new String[parameters.size()]); final String[] replacements = parameters.values().toArray(new String[parameters.size()]); return StringUtils.replaceEach(getServer(), search, replacements); }
private void writeGraphTag(String mode, String edgeType, OutputStream os) throws IOException { final String tag = StringUtils.replaceEach(GexfConstants.GRAPH_NODE_OPEN, new String[] {"%1", "%2"} , new String[] {mode, edgeType}); IOUtils.write(tag, os); writeGraphNodes(os); writeGraphEdges(os); IOUtils.write(GexfConstants.GRAPH_NODE_CLOSE, os); }
@Override public void writeGraph(OutputStream os) throws IOException { IOUtils.write(GraphvizConstants.METHOD_OPEN, os); final String tag = StringUtils.replaceEach(GraphvizConstants.CONSTRUCTOR_STATEMENT, new String[] {"%NAME", "%TYPE"} , new String[] {graphVariableName, type.getName()}); IOUtils.write(tag, os); writeGraphNodes(os); writeGraphEdges(os); IOUtils.write(GraphvizConstants.GRAPH_RENDERER, os); IOUtils.write(StringUtils.replace(GraphvizConstants.GRAPH_LAYOUT, "%DIRECTION", direction.getDirection()), os); IOUtils.write(StringUtils.replace(GraphvizConstants.GRAPH_RENDERER_RUN, "%NAME", graphVariableName), os); IOUtils.write(GraphvizConstants.METHOD_CLOSE, os); }
@Override public String buildRecoveryPasswordUrl(final User user, final String urlTemplate) { final String token = generateRecoveryToken(user); final String username = user.getUsername(); return StringUtils.replaceEach(urlTemplate, new String[]{"{username}", "{token}"}, new String[]{username, token}); }
public PropertySearchResult searchArtifactsByProperties(String properties) throws IOException { PreemptiveHttpClient client = httpClient.getHttpClient(); String replacedProperties = StringUtils.replaceEach(properties, new String[]{";", "+"}, new String[]{"&", ""}); String url = artifactoryUrl + "/api/search/prop?" + replacedProperties; PropertySearchResult result = readResponse(client.execute(new HttpGet(url)), new TypeReference<PropertySearchResult>() { }, "Failed to search artifact by the properties '" + properties + "'"); return result; }