List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
/** * Append string literal in XPath context. * * @param xpath StringBuilder for building XPath. * @param s string literal./*w ww . j a v a 2 s . c o m*/ */ public static void appendStringLiteral(StringBuilder xpath, String s) { if (s.indexOf('"') >= 0) { if (s.indexOf('\'') >= 0) xpath.append("concat(\"").append(s.replace("\"", "\",'\"',\"")).append("\")"); else xpath.append('\'').append(s).append('\''); } else { xpath.append('"').append(s).append('"'); } }
From source file:Main.java
public static String getStandardMobileFormat(String actualNumber) { String formattedNumber = null; if (actualNumber != null) { formattedNumber = actualNumber.replace("-", ""); if (!formattedNumber.startsWith("+91")) { if (formattedNumber.startsWith("+1")) { formattedNumber.replace("+", "+91"); } else if (formattedNumber.startsWith("0")) { formattedNumber = "+91" + formattedNumber.substring(1);// ignore 0 and start with +91 } else { formattedNumber = "+91" + formattedNumber; }/*from www . j a v a 2 s.c o m*/ } } return formattedNumber; }
From source file:io.apiman.common.util.ApimanPathUtils.java
/** * @param string string to replace # with %23 * @return the encoded string//from ww w . j av a 2 s . c o m */ public static String urlEncode(String string) { return string.replace("#", "%23"); }
From source file:Main.java
public static String getBaseClass(String className) { // Remove any array qualifiers, e.g. [[B (2d byte array) becomes B return className.replace("[", ""); }
From source file:Main.java
public static List<String> parse(String input) { List<String> term = new ArrayList<>(); for (String part : input.replace('"', ' ').split("\\s+")) { if (part.isEmpty()) { continue; }/*from w w w.jav a 2 s . co m*/ final String cleaned = clean(part); if (isKeyword(cleaned) || cleaned.contains("*")) { term.add(part); } else if (!cleaned.isEmpty()) { term.add(cleaned); } } return term; }
From source file:com.apps.android.viish.encyclolpedia.tools.ImageManager.java
public static String getChampionFileName(String championRealName) { return championRealName.replace("'", "").replace(" ", "").replace(".", ""); }
From source file:edu.cmu.cs.lti.ark.fn.data.prep.ParsePreparation.java
public static String replaceSentenceWithPTBWords(String sentence) { sentence = sentence.replace("-LRB-_", "(_"); sentence = sentence.replace("-RRB-_", ")_"); sentence = sentence.replace("-LSB-_", "[_"); sentence = sentence.replace("-RSB-_", "]_"); sentence = sentence.replace("-LCB-_", "{_"); sentence = sentence.replace("-RCB-_", "}_"); return sentence; }
From source file:Main.java
private static String getClassName(Type type) { if (type == null) { return ""; }/*from ww w .j ava2s . c om*/ String clazzName = type.toString(); if (clazzName.startsWith(TYPE_NAME_PREFIX)) { clazzName = clazzName.replace(TYPE_NAME_PREFIX, ""); } return clazzName; }
From source file:com.coveo.spillway.storage.RedisStorage.java
private static final String clean(String keyComponent) { return keyComponent.replace(KEY_SEPARATOR, "_"); }
From source file:Main.java
public static void backupComputationExperimentResults(String appendix) throws IOException { String name = COMPEXP_LOG_PATH.replace(".xml", "-" + appendix + ".xml"); while ((new File(name)).exists()) { name = name.replace(".xml", "-" + appendix + ".xml"); }/*from w w w .jav a 2 s. co m*/ Files.copy(new File(COMPEXP_LOG_PATH).toPath(), new File(name).toPath()); }