List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String toEmailHref(String email, String subject, String body) { body = body.replaceAll("\n", "%0D%0A"); return "mailto:" + email + "?subject=" + subject + "&body=" + body; }
From source file:Main.java
public static String schemaVersionToXmlns(String xml) { return xml.replaceAll(SCHEMA_VERSION_TAG + "=", XMLNS_TAG + "="); }
From source file:Main.java
public static String escapeXml(String xml) { return xml.replaceAll("<", "<").replaceAll(">", ">").replaceAll("\\$", "%"); }
From source file:Main.java
/** * Removes the namespace information from a given XML String. * This method should be used only when the namespace information is not known beforehand. Copied from * http://stackoverflow.com/questions/4661154/how-do-i-remove-namespaces-from-xml-using-java-dom * /*from ww w . j a va 2 s . c o m*/ * @param xmlString * XML without name space definitions * @return */ public static String removeNameSpaces(String xmlString) { return xmlString.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "").replaceAll("xsi.*?(\"|').*?(\"|')", "") .replaceAll("(<)(\\w+:)(.*?>)", "$1$3").replaceAll("(</)(\\w+:)(.*?>)", "$1$3"); }
From source file:Main.java
public static String xmlnsToSchemaVersion(String xml) { return xml.replaceAll(XMLNS_TAG + "=", SCHEMA_VERSION_TAG + "="); }
From source file:Main.java
/** * Replaces all dots in a filename with underscores except the last one. * // w ww .j a v a2 s . co m * @param filename * filename to sanitize * @return string with a single dot only */ public static String forceSingleExtension(final String filename) { return filename.replaceAll("\\.(?![^.]+$)", "_"); }
From source file:Main.java
public static int convertPrice(String price) { return Integer.parseInt(price.replaceAll("[^\\d]", "")); }
From source file:Main.java
public static String transformXmlToString(String XmlString) { return XmlString.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$ }
From source file:Main.java
public static String getCmdPath(String path, boolean al) { return path.replaceAll("\\$", "\\$").replaceAll(" ", "\\ ").replaceAll("\\*", "\\*") .replaceAll("\\?", "\\?").replaceAll("\\\\", "\\\\").replaceAll(">", "\\>").replaceAll("'", "\\'"); }
From source file:Main.java
/** * removes new lines/* w w w . ja v a 2 s .co m*/ * @return */ public static String trimNL(String str) { return str.replaceAll("\n", " "); }