List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String removeTags(String input) { String result = input; result = result.replaceAll("<([^<>]+)>", ""); return result; }
From source file:Main.java
public static String xmlConv(String input) { String s = input; s = s.replaceAll("&", "&"); s = s.replaceAll("<", "<"); s = s.replaceAll(">", ">"); s = s.replaceAll("'", "'"); s = s.replaceAll(""", "\""); return s;//w ww . j av a 2 s . c o m }
From source file:Main.java
public static String getXmlEncodedDoubleQuotes(String value) { return value.replaceAll("\"", """); }
From source file:Main.java
public static int convertPercent(String percent) { return Integer.parseInt(percent.replaceAll("[^\\d]", "")); }
From source file:Main.java
public static String replaceNamedEntitiesWithNumericEntities(String value) { return value.replaceAll(" ", " "); }
From source file:Main.java
/** * Convert to LF//w w w . ja va 2 s . c o m * @param text * @return */ public static String convertToLf(String text) { String repCrlf = text.replaceAll("\r\n", "\n"); String repLf = repCrlf.replaceAll("\r", "\n"); return repLf; }
From source file:Main.java
public static String unescapeXml(String xmlString) { String result = xmlString; result.replaceAll("<", "<"); result.replaceAll(">", ">"); result.replaceAll("&", "<"); result.replaceAll(""", "\""); result.replaceAll("'", "'"); // ' result.replaceAll("\", "\\"); return result; }
From source file:Main.java
public final static String makeShellCompatible(String name) { return name.replaceAll("[^a-zA-Z0-9_]", "_"); }
From source file:Main.java
public static String htmlspecialchars(String str) { str = str.replaceAll("&", "&"); str = str.replaceAll("<", "<"); str = str.replaceAll(">", ">"); str = str.replaceAll("\"", """); return str;//from w w w . j a v a 2 s .co m }
From source file:Main.java
/** * Returns a regular then marking word boundaries and ignoring case. * <p>/* w ww . j av a 2s. co m*/ * Example:<br /> * "group\\s+by" becomes "\\b(?:(i?)group\\s+by)\\b" * </p> */ public static String word(String word) { return "\\b((?i)" + word.replaceAll("\\s+", "\\\\s+") + ")\\b"; }