List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
/** * Replaces all <tt>'>'</tt> characters with <tt>'>'</tt> * @param aString//from w w w .j ava2 s .co m * @return */ private static String escapeGreaterThanSigns(String aString) { return aString.replace(">", "&" + PREDEFINED_ENTITY_GREATERTHAN_SIGN + ";"); }
From source file:Main.java
/** * Replaces all <tt>'\''</tt> characters with <tt>'''</tt> * @param aString//from w w w . j a va2 s. c o m * @return */ private static String escapeApostrophes(String aString) { return aString.replace("'", "&" + PREDEFINED_ENTITY_APOSTROPHE + ";"); }
From source file:Main.java
public static String convertToXMLString(String instr) { //XML has a special set of characters that cannot be used in normal XML strings String ourstr = instr; ourstr = ourstr.replace("&", "&"); ourstr = ourstr.replace("<", "<"); ourstr = ourstr.replace(">", ">"); ourstr = ourstr.replace("\"", """); ourstr = ourstr.replace("'", "'"); return ourstr; }
From source file:Main.java
/** * Replaces all <tt>'&'</tt> characters with <tt>'&'</tt> * @param aString/* w w w . java 2 s. c o m*/ * @return */ private static String escapeAmpersands(String aString) { return aString.replace("&", "&" + PREDEFINED_ENTITY_AMPERSAND + ";"); }
From source file:Main.java
/** * The method parseRuby converts kanji enclosed in ruby tags to the * format which is supported by the textview {Kanji:furigana} * * @param textWithRuby/*from w w w .j a v a2 s. com*/ */ public static String parseRuby(String textWithRuby) { String parsed = textWithRuby.replace("<ruby>", "{"); parsed = parsed.replace("<rt>", ";"); parsed = parsed.replace("</rt>", ""); return parsed.replace("</ruby>", "}"); }
From source file:Main.java
private static String escapeHTML(final String content) { String escaped = content.replace("&", "&"); escaped = escaped.replace("<", "<"); escaped = escaped.replace(">", ">"); escaped = escaped.replace("\r\n", "\n"); escaped = escaped.replace("\r", "\n"); escaped = escaped.replace("\n", "<br/>"); return escaped; }
From source file:Main.java
/** * Decode specials chars for XML representation * /*from w w w . j a v a2s . c o m*/ * @param pi_text The encoded text * @return The decoded text */ public static String Decode(String pi_text) { pi_text = pi_text.replace("&", "&"); pi_text = pi_text.replace("'", "'"); return pi_text; }
From source file:Main.java
/** * To html./*from w ww.j av a 2 s. c om*/ * * @param src * the src * @return the string */ public static String ToHtml(String src) { src = src.replace("\r\n", "<br>"); src = src.replace("\n", "<br>"); src = src.replace("\r", "<br>"); src = src.replace(" ", " "); ToJavascriptText(src); return src; }
From source file:Main.java
private static String __htmlTextToPlainText(String text) { text = text.replace("<", "<"); text = text.replace(">", ">"); return text;/*from ww w . ja v a 2 s .c o m*/ }
From source file:Main.java
public static String getProjectRelativeRelativePath(String path, String buildDir) { path = path.replace('\\', '/'); buildDir = buildDir.replace('\\', '/'); int indexOfBuildDir = path.indexOf(buildDir); if (indexOfBuildDir == 0) { path = path.substring(buildDir.length()); }//w ww . ja va 2s .com if (path.startsWith("/")) { return path.substring(1); } return path; }