List of usage examples for org.apache.commons.lang3 StringUtils replace
public static String replace(final String text, final String searchString, final String replacement)
Replaces all occurrences of a String within another String.
A null reference passed to this method is a no-op.
StringUtils.replace(null, *, *) = null StringUtils.replace("", *, *) = "" StringUtils.replace("any", null, *) = "any" StringUtils.replace("any", *, null) = "any" StringUtils.replace("any", "", *) = "any" StringUtils.replace("aba", "a", null) = "aba" StringUtils.replace("aba", "a", "") = "b" StringUtils.replace("aba", "a", "z") = "zbz"
From source file:kenh.expl.functions.ReplaceBlank.java
public String process(String text, String replacement) { return StringUtils.replace(text, " ", replacement); }
From source file:edu.usf.cutr.obascs.io.ConfigFileGenerator.java
public static String generateStopConsolidationScriptConfigFile(String configXml, Map<String, String> agencyMap) { StringBuilder bundleNamesBuilder = new StringBuilder(); StringBuilder gtfsBeansBuilder = new StringBuilder(); for (Map.Entry<String, String> agency : agencyMap.entrySet()) { bundleNamesBuilder.append("<ref bean=\"gtfs_").append(agency.getValue()).append("\" />") .append(SystemUtils.LINE_SEPARATOR); gtfsBeansBuilder.append("<bean id=\"gtfs-").append(agency.getValue()) .append("\" class=\"org.onebusaway.transit_data_federation.bundle.model.GtfsBundle\">"); gtfsBeansBuilder.append(SystemUtils.LINE_SEPARATOR); gtfsBeansBuilder.append("<property name=\"path\" value=\"${bundle.root}/").append(agency.getValue()) .append("/final\" />"); gtfsBeansBuilder.append(SystemUtils.LINE_SEPARATOR); gtfsBeansBuilder.append("<property name=\"defaultAgencyId\" value=\"").append(agency.getKey()) .append("\" />"); gtfsBeansBuilder.append(SystemUtils.LINE_SEPARATOR); gtfsBeansBuilder.append(" </bean>"); }//from ww w .j a v a2 s.c o m configXml = StringUtils.replace(configXml, "${bundleNames}", bundleNamesBuilder.toString()); configXml = StringUtils.replace(configXml, "${gtfsBeans}", gtfsBeansBuilder.toString()); return configXml; }
From source file:net.longfalcon.taglib.TextFunctions.java
public static String replace(String s, String oldStr, String newStr) { return StringUtils.replace(s, oldStr, newStr); }
From source file:de.micromata.genome.gwiki.page.impl.wiki.parser.WeditWikiUtils.java
public static String weditToWiki(String text) { String ret = StringUtils.defaultString(text); ret = StringUtils.replace(ret, "<br/>", ""); ret = StringUtils.replace(ret, "<br>", ""); ret = StringUtils.replace(ret, "</br>", ""); ret = StringUtils.replace(ret, " ", " "); // ret = StringUtils.replace(ret, "\n", ""); // ret = StringUtils.replace(ret, "\r", ""); // ret = StringUtils.replace(ret, "</p>", "\n"); // ret = StringUtils.replace(ret, "<p>", ""); ret = StringUtils.replace(ret, "<", "<"); ret = StringUtils.replace(ret, ">", ">"); LOG.debug("weditToWiki\nwedit: " + text + "\n\nwiki: " + ret); return ret;/*from ww w . j a v a2 s.com*/ }
From source file:de.micromata.genome.util.matcher.norm.StringNormalizeUtils.java
/** * Replace specifc composits.//from ww w. ja va 2 s . c o m * * @param text the text * @return the string */ public static String replaceSpecifcComposits(String text) { text = StringUtils.replace(text, "\u00df", "ss"); return text; }
From source file:mfi.staticresources.ProcessResources.java
private String minifyCSS(String content) { content = deleteBetween(content, "/*", "*/", "license-attribution"); content = replace(content, "\t", ""); content = replace(content, "\r", ""); content = replace(content, "\n\n", "\n"); content = trimAround(content, "\n"); content = trimAround(content, "{"); content = trimAround(content, ":"); content = replace(content, ",\n", ","); content = trimAround(content, ","); content = replace(content, "{\n", "{"); content = replace(content, ";\n", ";"); content = replace(content, "\n}", "}"); content = replace(content, ";}", "}"); // hacks/*from ww w .j a va 2 s. c om*/ content = StringUtils.replace(content, "@charset \"UTF-8\";", "@charset \"UTF-8\";\n"); return content; }
From source file:kenh.expl.functions.Replace.java
public String process(String text, String searchString, String replacement) { return StringUtils.replace(text, searchString, replacement); }
From source file:io.wcm.sling.commons.util.Escape.java
/** * Creates a valid node name. Replaces all chars not in a-z, A-Z and 0-9 or '_' with '-' and converts all to lowercase. * @param value String to be labelized./*from ww w . ja v a 2 s. c om*/ * @return The labelized string. */ public static String validName(String value) { // convert to lowercase String text = value.toLowerCase(); // replace some special chars first text = StringUtils.replace(text, "", "ae"); text = StringUtils.replace(text, "", "oe"); text = StringUtils.replace(text, "", "ue"); text = StringUtils.replace(text, "", "ss"); // replace all invalid chars StringBuilder sb = new StringBuilder(text); for (int i = 0; i < sb.length(); i++) { char ch = sb.charAt(i); if (!((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || (ch == '_'))) { ch = '-'; sb.setCharAt(i, ch); } } return sb.toString(); }
From source file:io.wcm.devops.maven.nodejsproxy.resource.IndexPageBuilder.java
/** * Build HTML index page/* w w w .j ava 2s .c o m*/ */ public static String build(MavenProxyConfiguration config) { StringBuilder exampleUrlsMarkup = new StringBuilder(); for (String exampleUrl : EXAMPLE_URLS) { String url = exampleUrl; url = StringUtils.replace(url, "${groupIdPath}", StringUtils.replace(config.getGroupId(), ".", "/")); url = StringUtils.replace(url, "${nodeJsArtifactId}", config.getNodeJsArtifactId()); url = StringUtils.replace(url, "${npmArtifactId}", config.getNpmArtifactId()); url = StringUtils.replace(url, "${nodeJsSampleVersion}", config.getNodeJsSampleVersion()); url = StringUtils.replace(url, "${npmSampleVersion}", config.getNpmSampleVersion()); exampleUrlsMarkup.append("<li><a href=\"").append(url).append("\">").append(url).append("</a></li>"); } String serviceVersion = IndexPageBuilder.class.getPackage().getImplementationVersion(); return "<!DOCTYPE html>\n<html>" + "<head>" + "<title>Maven NodeJS Proxy</title>" + "<style>body { font-family: sans-serif; }</style>" + "</head>" + "<body>" + "<h1>Maven NodeJS Proxy</h1>" + "<p>This is a Maven Artifact Proxy for NodeJS binaries located at: " + "<a href=\"" + config.getNodeJsBinariesRootUrl() + "\">" + config.getNodeJsBinariesRootUrl() + "</a></p>" + "<p>Every call to this repository is routed directly to this URL.</p>" + "<p><strong>Please never use this Maven repository directly in your maven builds, but only via an Repository Manager " + "which caches the resolved artifacts.</strong></p>" + "<p>If you want to setup your own proxy get the source code: " + "<a href=\"https://github.com/wcm-io-devops/maven-nodejs-proxy\">https://github.com/wcm-io-devops/maven-nodejs-proxy</a></p>" + "<hr/>" + "<p>Examples:</p>" + "<ul>" + exampleUrlsMarkup + "</ul>" + "<p>For all files SHA1 checksums are supported (.sha1 suffix). MD5 checksums are not supported.</p>" + (serviceVersion != null ? "<hr/><p>Version " + IndexPageBuilder.class.getPackage().getImplementationVersion() + ".</p>" : "") + "</body>" + "</html>"; }
From source file:com.navercorp.pinpoint.plugin.thrift.ThriftUtils.java
/** * Returns the name of the specified {@link org.apache.thrift.TServiceClient TServiceClient} * to be used in Pinpoint./*from www . j a v a 2 s .c o m*/ */ public static String getClientServiceName(TServiceClient client) { String clientClassName = client.getClass().getName(); return StringUtils.replace(CLIENT_PATTERN.split(clientClassName)[0], ".", "/"); }