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:com.eryansky.common.web.struts2.converter.BigDecimalConverter.java
@Override public Object convertFromString(Map context, String[] values, Class toClass) { if (values != null && values.length > 0) { if (values[0].indexOf(',') != -1) { return new BigDecimal(StringUtils.replace(values[0], ",", "")); } else {/*from w ww. ja v a2 s. com*/ return new BigDecimal(values[0]); } } return null; }
From source file:com.navercorp.pinpoint.plugin.thrift.ThriftUtils.java
/** * Returns the name of the specified {@link org.apache.thrift.TBaseAsyncProcessor TBaseAsyncProcessor} * as uri to be used in Pinpoint.//from ww w . j a va2 s . c om */ public static String getAsyncProcessorNameAsUri(TBaseAsyncProcessor<?> asyncProcessor) { String actualAsyncProcessorName = asyncProcessor.getClass().getName(); return StringUtils.replace(ASYNC_PROCESSOR_PATTERN.matcher(actualAsyncProcessorName).replaceAll("."), ".", "/"); }
From source file:fm.audiobox.core.utils.ModelUtil.java
/** * Performs models urls interpolation with the {@link fm.audiobox.core.utils.ModelUtil#ID_PLACEHOLDER}. * * @param url the url/*w w w. java 2 s. c o m*/ * @param id the id * * @return the computed url interpolation */ public static String interpolate(String url, long id) { return StringUtils.replace(url, ID_PLACEHOLDER, String.valueOf(id)); }
From source file:com.thruzero.common.web.util.HtmlUtils.java
/** * @param text//from w w w. j a v a 2s.c o m * @return given text with <br> * after each new line. */ public static String formatLinefeedWrap(String text) { if (text == null) { text = ""; } return StringUtils.replace(text, "\n", "<br>\n"); }
From source file:de.micromata.genome.logging.Escape.java
/** * Replaces all Null-Bytes in the value//from w ww .j a va 2 s . c o m * This is required, because i.e. Postgres fails with exception "invalid byte sequence 0x00" * * @param value the value where to replace the null values in * @return the modified value */ public static String nullBytes(String value) { return StringUtils.replace(value, "\u0000", "\\0"); }
From source file:kenh.expl.functions.ReplaceBlank.java
public String process(String text) { return StringUtils.replace(text, " ", ""); }
From source file:com.sk89q.craftbook.sponge.mechanics.area.complex.CopyManager.java
/** * Checks if the area and namespace exists. * * @param namespace to check//from ww w . ja v a 2 s . c om * @param area to check * * @return If the area exists */ static boolean isExistingArea(File dataFolder, String namespace, String area) { area = StringUtils.replace(area, "-", "") + getFileSuffix(); File file = new File(dataFolder, "areas/" + namespace); return new File(file, area).exists(); }
From source file:info.devbug.core.UnixCifsUrlConverter.java
@Override public String convert(String windowsCifsUrl, boolean ignoreSpaces) { Pattern pattern = Pattern.compile(CIFS_URL_PATTERN); Matcher matcher = pattern.matcher(windowsCifsUrl); boolean isMatch = matcher.matches(); if (isMatch) { String cifsPrefix = "smb://"; // Windows cifs url starts from right slashes "//". We should remove them String url = StringUtils.remove(windowsCifsUrl, "\\\\"); String unixUrl = StringUtils.replace(url, "\\", "/"); if (!ignoreSpaces) { unixUrl = convertWithSpaces(unixUrl); }/*from w w w.j ava2 s . c o m*/ String finalUnixUrl = cifsPrefix + unixUrl; return finalUnixUrl; } return "Incorrect CIFS url"; }
From source file:com.epam.dlab.Help.java
/** Print help to console. * @param resourceName the name of resource. * @param substitute - map for substitution in help content. * @throws InitializationException//w w w .j a v a 2 s . co m */ private static void printHelp(String resourceName, Map<String, String> substitute) throws InitializationException { List<String> list = BillingUtils .getResourceAsList("/" + Help.class.getName() + "." + resourceName + ".txt"); String help = StringUtils.join(list, System.lineSeparator()); if (substitute == null) { substitute = new HashMap<>(); } substitute.put("classname", BillingScheduler.class.getName()); for (String key : substitute.keySet()) { help = StringUtils.replace(help, "${" + key.toUpperCase() + "}", substitute.get(key)); } System.out.println(help); }
From source file:kenh.expl.functions.Replace.java
public String process(String text, String searchString) { return StringUtils.replace(text, searchString, ""); }