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:de.micromata.genome.gdbfs.FileNameUtils.java
public static String normalize(String name) { if (StringUtils.isEmpty(name) == true) { return name; }/*from w ww .j a va 2 s.co m*/ name = StringUtils.replace(name, "\\", "/"); name = StringUtils.replace(name, "//", "/"); return name; }
From source file:musiccrawler.common.HtmlToolFix.java
public static String fixName(String name) { if (StringUtils.isNotBlank(name)) { return StringUtils.replace(name, Constant.CharacterSpec.SEMI_COLON, " " + Constant.SINGER_FEATURING) .trim();/*from ww w.j a v a 2s . c om*/ } return Constant.EMPTY; }
From source file:gov.nih.nci.cadsr.cadsrpasswordchange.core.EmailHelper.java
public static String handleDaysToken(String originalText, int daysLeft) { String ret = originalText;//from w w w . jav a 2 s.c o m if (originalText != null) { ret = StringUtils.replace(originalText, Constants.EMAIL_DAYS_TOKEN, String.valueOf(daysLeft)); } return ret; }
From source file:brut.androlib.res.xml.ResXmlEncoders.java
public static String escapeXmlChars(String str) { return StringUtils.replace(StringUtils.replace(str, "&", "&"), "<", "<"); }
From source file:de.micromata.genome.gwiki.plugin.rogmp3_1_0.RecBase.java
public static String normalize(String n) { n = StringUtils.replace(n, " ", "_"); return n; }
From source file:de.micromata.genome.util.text.PipeValueList.java
/** * Escape a key or value./*from w ww. j a v a 2 s .com*/ * * @param k the k * @return the string */ public static String escape(String k) { k = StringUtils.replace(k, "\\", "\\\\"); k = StringUtils.replace(k, "|", "\\|"); k = StringUtils.replace(k, "=", "\\="); return k; }
From source file:io.wcm.devops.conga.resource.AbstractClasspathResourceImpl.java
protected static String convertPath(String path) { return StringUtils.replace(StringUtils.removeStart(path, "/"), "\\", "/"); }
From source file:de.micromata.genome.logging.Escape.java
/** * Escapes untrusted data for writing it safely into a log file. * Prevents Log forging/Log injection/* ww w.j a v a2s. c o m*/ * * Log forging vulnerabilities occur when data from an untrusted source (ie. userinput) * is written to an application/system log file without escaping the. * * Used Example Code from here: http://www.baeldung.com/jvm-log-forging * * @param untrustedData the data we want to escape so we can trust it. * @return escaped data that could be safely written to a log file */ public static String forLog(String untrustedData) { String escapedData = untrustedData; escapedData = StringUtils.replace(escapedData, "\n", "\\n"); escapedData = StringUtils.replace(escapedData, "\r", "\\r"); escapedData = StringUtils.replace(escapedData, "\t", "\\t"); return escapedData; }
From source file:com.navercorp.pinpoint.plugin.thrift.ThriftUtils.java
/** * Returns the name of the specified {@link org.apache.thrift.TBaseProcessor TBaseProcessor} * as uri to be used in Pinpoint.// w ww. j a v a2s . c o m */ public static String getProcessorNameAsUri(TBaseProcessor<?> processor) { String actualProcessorName = processor.getClass().getName(); return StringUtils.replace(PROCESSOR_PATTERN.matcher(actualProcessorName).replaceAll("."), ".", "/"); }
From source file:com.mocktpo.util.EmailUtils.java
private static String getActivationCode(License lic) { String plain = prepareActivationCode(lic); String encoded = ActivationCodeUtils.encode(plain); encoded = StringUtils.replace(encoded, "-----BEGIN PGP MESSAGE-----\nVersion: BCPG v1.52", "-----BEGIN MOCKTPO ACTIVATION CODE-----"); encoded = StringUtils.replace(encoded, "-----END PGP MESSAGE-----", "\n-----END MOCKTPO ACTIVATION CODE-----"); return encoded; }