List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
public static String amount2String(String amount) { String temp = amount.replace(".", "").replace(",", ""); return String.format("%012d", Long.parseLong(temp)); }
From source file:Main.java
/** * <p>//w w w . j ava2s . c o m * Escapes XML reserved characters to their corresponding XML-safe versions. * Specifically, this method: * </p> * <xmp> Replaces & with & Replaces < with < Replaces > with > * </xmp> * * @param txt * Source string with text that needs to have XML characters * escaped * @return String that has reserved XML characters escaped */ public static String escapeXMLText(String txt) { return txt.replace("&", "&").replace("<", "<").replace(">", ">"); }
From source file:Main.java
public static String htmldecode(String str) { str = str.replace("&", "&"); str = str.replace(" ", " "); str = str.replace(""", "\""); str = str.replace("'", "'"); str = str.replace("<", "<"); str = str.replace(">", ">"); str = str.replace("<br[^>]*>(?:(rn)|r|n)?", "n"); return str;// w ww .j a v a 2 s . co m }
From source file:Main.java
private static String convertURI(String fileURL) { return fileURL.replace('\\', '/'); }
From source file:Main.java
private static String getClassFullName(String packagePath) { return packagePath.replace(File.separator, DOT).replace(EXT, BLANK_STR); }
From source file:Main.java
/** * Unescape XML characters, and also replace our special token for preserving a carriage return followed by a line * feed.// w w w. j av a 2 s .c o m * * @param body * @return */ public static String unescapeBody(String body) { body = body.replace("<", "<"); body = body.replace(">", ">"); body = body.replace("CARRIAGERETURN\n", "\r\n"); return body; }
From source file:Main.java
/** * Takes an escaped string, as generated by {@link XMLUtils#escapeData(String)} and returns its original form. * //from w w w .j a va2 s . c o m * @param data escaped string as generated by {@link XMLUtils#escapeData(String)}, never null. * @return original, unescaped string, never null. */ public static String unEscapeData(String data) { data = data.replace("<", "<"); data = data.replace(">", ">"); data = data.replace("&", "&"); return data; }
From source file:Main.java
public static final String escapeEntities(String s) { return s.replace("&", "&").replace("<", "<");//.replace(">", ">"); }
From source file:Main.java
public static Long longFromString(String s) { s = s.replace(",", "").replace(".", "").replace(" ", ""); try {// w ww . jav a 2 s . c om return Long.valueOf(s); } catch (Exception e) { e.printStackTrace(); } return 0l; }
From source file:Main.java
public static String modifyHtmlQuote(String body) { return Html.fromHtml(body.replace("\n", "<br/>")).toString(); }