List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
/** * In addition to escaping certain XML characters, we need to replace a carriage return + a line feed, because when * it's read back in, only the line feed is preserved. But flexrep isn't happy with the multipart data unless the * carriage returns are there as well./* w ww.ja v a2s . c o m*/ * * @param body * @return */ public static String escapeBody(String body) { body = body.replace("<", "<"); body = body.replace(">", ">"); body = body.replace("\r\n", "CARRIAGERETURN\n"); return body; }
From source file:Main.java
/** \0 is not allowed: */ public static String makeValidXml(final String pXmlNoteText) { return pXmlNoteText.replace('\0', ' '); }
From source file:Main.java
public static String encodeEntities(String content) { content = content.replace("&", "&"); content = content.replace("<", "<"); content = content.replace(">", ">"); content = content.replace("\"", """); content = content.replace("'", "'"); return content; }
From source file:Main.java
public static String javaToDexName(String javaName) { javaName = javaName.replace('.', '/'); if (javaName.length() > 1 && javaName.charAt(javaName.length() - 1) != ';') { javaName = 'L' + javaName + ';'; }/*w w w .java 2s .c o m*/ return javaName; }
From source file:Main.java
public static String htmlEscape(String str) { return str.replace(">", ">").replace("<", "<").replace("&", "&"); }
From source file:Main.java
public static String validateIcalUrl(String url) { url = url.replace("page=calendar", "page=ical"); if (!isValidURL(url)) return null; return url;// ww w.j av a2 s . c o m }
From source file:Main.java
/** * Takes an arbitrary string and encodes it in a way which allows its use as content of an XML element.<br/> * The string is left unchanged, if it does not violate any XML requirements. Otherwise it is encapsulated * in a CDATA element. //w ww . ja v a 2 s . c o m * * @param data the string to escape, never null. * @return escaped version of the given string which is save for use as content of an XML element, never null. */ public static String escapeData(String data) { data = data.replace("&", "&"); data = data.replace("<", "<"); data = data.replace(">", ">"); return data; }
From source file:Main.java
public static String setPhoneNumber(String num) { return num.replace("+82", "0"); }
From source file:Main.java
private static String base64ToBase64Url(String base64) { return base64.replace('+', '-').replace('/', '_'); }
From source file:Main.java
public static long ip2int(String ip) { ip = ip.replace(".", ","); String[] items = ip.split(","); return Long.valueOf(items[0]) << 24 | Long.valueOf(items[1]) << 16 | Long.valueOf(items[2]) << 8 | Long.valueOf(items[3]); }