List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String removeHtmlTag(String input) { String str = input.replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", ""); str = str.replaceAll("[(/>)<]", ""); return str;//from w ww .j a v a 2 s.c o m }
From source file:Main.java
public static String makeXMLSafe(String xml) { xml = xml.replaceAll("&", "&"); xml = xml.replaceAll("'", "'"); xml = xml.replaceAll(">", ">"); xml = xml.replaceAll("<", "<"); xml = xml.replaceAll("\"", """); return xml;// w w w . j av a 2 s .c o m }
From source file:Main.java
/** * Change space character to underscore character * * @param strOrigin/*from w ww .jav a 2 s .c om*/ * @return */ public static String replaceSpaceToUnderscore(String strOrigin) { return strOrigin.replaceAll(" ", "_").toLowerCase(); }
From source file:Main.java
public static String escapeXML(String beforeEscapeXML) { return beforeEscapeXML.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">") .replaceAll("'", "'").replaceAll("\"", """); }
From source file:Main.java
public static String UnEscapeString(String xml) { String str = xml.replaceAll("&", "&"); str = str.replaceAll("\"", """); str = str.replaceAll(">", ">"); str = str.replaceAll("<", "<"); return str;/*from w w w . java 2s . c o m*/ }
From source file:Main.java
public static int getIntFromString(String s) { String tmp = s.replaceAll("[^\\d]", ""); if (!tmp.isEmpty()) { return Integer.parseInt(tmp); } else {/* w w w. ja v a 2 s . c o m*/ return 0; } }
From source file:Main.java
public static String removeRegex(String groupidsWithReg) { return groupidsWithReg.replaceAll(reg, " "); }
From source file:Main.java
/** * Strips all characters from a String, that might be invalid to be used in * file names. By default <tt>: / \ < > | ? " *</tt> are all replaced by * <tt>-</tt>. Note that this is no guarantee that the returned name will be * definately valid./*from w w w. jav a 2s .com*/ * * @param s the String to clean up * @return the cleaned up String */ public static String cleanUp(final String s) { return s.replaceAll("[*:/\\\\?|<>\"]", "-"); }
From source file:Main.java
/** * Replace certain characters usually found when cp1252 text is pasted, * removing the rest of HTML4 forbidden characters in the range #x7F-#x9F. * * http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-RestrictedChar * * @param in The String to correct/*from ww w . ja va 2 s . c o m*/ * @return Cleaned up from characters in the range #x7F-#x9F */ public static String cleanupControlCharacters(String in) { return in.replaceAll("\\u0084", "\u201E").replaceAll("\\u0093", "\u201C").replaceAll("\\u0095", "\u2022") .replaceAll("\\u0096", "\u2013").replaceAll("[\\u0001-\\u0008]", "") .replaceAll("[\\u000B-\\u000C]", "").replaceAll("[\\u000E-\\u001F]", "") .replaceAll("[\\u007F-\\u0084]", "").replaceAll("[\\u0086-\\u009F]", ""); }
From source file:Main.java
public static String transformStringToXml(String value) { return value.replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&") //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$ .replaceAll(""", "\"") //$NON-NLS-1$ //$NON-NLS-2$ .replaceAll("'", "'"); //$NON-NLS-1$ //$NON-NLS-2$ }