List of usage examples for org.apache.commons.lang StringUtils replace
public static String replace(String text, String searchString, String replacement)
Replaces all occurrences of a String within another String.
From source file:de.alpharogroup.crypto.keyrules.Obfuscator.java
/** * {@inheritDoc}// w w w . j a va2 s . c om */ @Override public String disentangle() { String clonedKey = obfuscate(); final Map<String, String> rules = rule.getRules(); for (final Map.Entry<String, String> rule : rules.entrySet()) { clonedKey = StringUtils.replace(clonedKey, rule.getValue(), rule.getKey()); } return clonedKey; }
From source file:immf.Util.java
/** * ????????/*from w ww . j ava 2 s . c o m*/ * @param s * @return */ public static String replaceUnicodeMapping(String s) { if (StringUtils.isEmpty(System.getProperty("sun.nio.cs.map"))) { s = StringUtils.replace(s, "\uff5e", "\u301c"); s = StringUtils.replace(s, "\u2225", "\u2016"); s = StringUtils.replace(s, "\uff0d", "\u2212"); s = StringUtils.replace(s, "\uffe0", "\u00a2"); s = StringUtils.replace(s, "\uffe1", "\u00a3"); s = StringUtils.replace(s, "\uffe2", "\u00ac"); s = StringUtils.replace(s, "\u2015", "\u2014"); } // sun.nio.cs.map ??????iso-2022-jp??? // x-windows-iso2022jp????????????? return s; }
From source file:com.sfs.beans.SQLBean.java
/** * Instantiates a new sQL bean./*from w w w.j av a 2 s. c o m*/ * * @param sqlPropertiesName the sql properties name */ public SQLBean(final String sqlPropertiesName) { /** * Loads SQL commands into memory from properties file **/ if (sqlPropertiesName != null) { ResourceBundle sqlBundle = ResourceBundle.getBundle(sqlPropertiesName); Enumeration<String> keySet = sqlBundle.getKeys(); while (keySet.hasMoreElements()) { String sqlKey = keySet.nextElement(); String sqlValue = sqlBundle.getString(sqlKey); sqlKey = StringUtils.replace(sqlKey, ".", "/"); if (sqlValue == null) { sqlValue = ""; } this.setValue(sqlKey, sqlValue); } } }
From source file:br.com.renatoccosta.regexrenamer.element.ReplaceElement.java
@Override public String convert(String src) { return StringUtils.replace(src, from, to); }
From source file:com.alibaba.stonelab.toolkit.autoconf.Autoconf.java
private void init(List<String> files) { for (String file : files) { String f = StringUtils.replace(file, "\\", "/"); String base = StringUtils.substringBeforeLast(file, "/"); try {//from www . j a v a 2s . co m parser(base, f); } catch (Exception e) { throw new AutoconfException("Parser error."); } } }
From source file:com.cognifide.cq.cqsm.core.scripts.ScriptUtils.java
public static String parseCommand(String command, Map<String, String> definitions) throws ActionCreationException { command = StringUtils.strip(command); Set<String> definitionNames = new HashSet<>(); Matcher matcher = DEFINITION.matcher(command); while (matcher.find()) { String definitionName = matcher.group(1); definitionNames.add(definitionName); }/*from w w w . j a va 2s .c om*/ for (String definitionName : definitionNames) { if (definitions == null) { throw new ActionCreationException("Definitions map is not specified"); } String definitionValue = definitions.get(definitionName); if (definitionValue == null) { throw new ActionCreationException("Definition " + definitionName + " not found"); } command = StringUtils.replace(command, String.format("${%s}", definitionName), definitionValue); } return command; }
From source file:cn.vlabs.duckling.vwb.ui.action.HtmlValidateUtil.java
public static String disabledSubmit(String html) { html = StringUtils.replace(html, "submit", "button"); for (String url : getInvalidateFormAction()) { html = StringUtils.replace(html, url, ""); }// w ww.java2 s . c om return html; }
From source file:edu.ku.brc.specify.tools.datamodelgenerator.DataModelToCSV.java
protected String fixText(final String text) { return StringUtils.replace(text, "'", "\'"); }
From source file:com.beinformed.framework.osgi.osgitest.base.TestSuiteBase.java
public TestSuiteBase(Class<?> clazz) { this(StringUtils.replace(clazz.getName(), ".", "/")); }
From source file:net.sf.zekr.common.config.ResourceManager.java
public String getString(String key, Object[] strArray) { String val = getString(key); for (int i = 0; i < strArray.length; i++) { val = StringUtils.replace(val, "{" + (i + 1) + "}", strArray[i].toString()); }//from w w w. ja v a 2 s .c om return val; }