List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
public static String decodeSpecialCharsForFileSystem(String projectName) { projectName = projectName.replace("%2E", "."); projectName = projectName.replace("%2A", "*"); projectName = projectName.replace("%7C", "|"); projectName = projectName.replace("%5C", "\\"); projectName = projectName.replace("%3F", "?"); projectName = projectName.replace("%3E", ">"); projectName = projectName.replace("%3C", "<"); projectName = projectName.replace("%3A", ":"); projectName = projectName.replace("%2F", "/"); projectName = projectName.replace("%22", "\""); projectName = projectName.replace("%25", "%"); return projectName; }
From source file:Main.java
public static String getUUIDString() { String UUIDString = UUID.randomUUID().toString(); String newUUIDString = UUIDString.replace("-", ""); String substring = newUUIDString.substring(0, 10); return substring; }
From source file:eu.asyncro.passmatters.network.JsonAdapter.java
/** * Returns login token from received JSON string. * @param jsonString JSON with 'token' field * @return String token/*from w w w . j a v a2s .c o m*/ */ public static String getToken(String jsonString) { jsonString = jsonString.replace(END, ""); JSONObject object = new JSONObject(jsonString); if (object.getInt(CODE) == 1 && object.getString(MESSAGE).equals("Success")) { System.out.println(object.getString("token")); return object.getString("token"); } else return null; }
From source file:Main.java
public static String fromIdableName(String xpath) { xpath = xpath.substring(1);//from w w w. j a va2s . c om xpath = xpath.replace("-", "/"); xpath = xpath.replace("_", "["); return xpath.replace(":", "]"); }
From source file:org.shredzone.cilla.plugin.social.renderer.SocialFragmentRenderer.java
/** * Escapes HTML entities.//from w w w .j av a 2 s. c o m * * @param str * String to escape * @return escaped string */ private static String escape(String str) { return str.replace("&", "&").replace("<", "<").replace("\"", """); }
From source file:util.Slack.java
private static String converteCaracteresEspeciais(String str) { return str.replace("", "c").replace("", "C").replace("", "a"); }
From source file:Main.java
/** * Returns a string surrounded with quotes, or an unquoted string "null" * * @param string The string to quote/*from w w w . j a v a2 s . c om*/ * @return The quoted string */ public static String quotedStringOrNull(String string) { return (string == null) ? "null" : ("\"" + string.replace("\\", "\\\\").replace("\"", "\\\"") + "\""); }
From source file:Main.java
public static String formatPhoneNum(String phoneNum) { String target = phoneNum.substring(3, 7); phoneNum = phoneNum.replace(target, "*****"); return phoneNum; }
From source file:Main.java
public static double getDoubleFrom(String txt) { double val = 0; if (!"".equals(txt.replace(" ", "")) && !".".equals(txt) && !",".equals(txt) && !"-".equals(txt)) { val = Double.parseDouble(txt); }//from ww w .ja va2 s .c o m return val; }
From source file:Main.java
public static String getPath(final String iPath) { if (iPath == null) return null; return iPath.replace('\\', '/'); }