Example usage for java.lang String replaceAll

List of usage examples for java.lang String replaceAll

Introduction

In this page you can find the example usage for java.lang String replaceAll.

Prototype

public String replaceAll(String regex, String replacement) 

Source Link

Document

Replaces each substring of this string that matches the given regular expression with the given replacement.

Usage

From source file:Main.java

public static String elementContentFilter(String s) {
    return s.replaceAll("<", "&lt;").replaceAll("&", "&amp;").replaceAll("]]>", "]]&amp;");
}

From source file:Main.java

public static String unmask(String s) {
    return s.replaceAll("[^0-9]*", "");
}

From source file:Main.java

public final static String toNbsp(String s) {
    return s.replaceAll(" ", "&nbsp;");
}

From source file:Main.java

public static String commentContentFilter(String s) {
    return s.replaceAll("--", "");
}

From source file:Main.java

public static String removeSpecialCharacters(String s) {
    return s.replaceAll("\\W", "");
}

From source file:Main.java

public static String arributeContentFilter(String s) {
    return s.replaceAll("<", "&lt;").replaceAll("&", "&amp;").replaceAll("\"", "&quot;");
}

From source file:Main.java

public static String getStringWithoutSurroundingQuotes(String s) {
    s = s.replaceAll("^\"", ""); // start quotations mark
    s = s.replaceAll("\"$", ""); // end quotation mark
    return s;/*w w w.  jav  a  2s  . com*/
}

From source file:Main.java

public static String _escapeXMLChars(String s) {
    return s.replaceAll("&", "&amp;").replaceAll("'", "&apos;").replaceAll("\"", "&quot;")
            .replaceAll("<", "&lt;").replaceAll(">", "&gt;");
}

From source file:Main.java

public static String encodeURL(String url) {
    return url.replaceAll(" ", "+").replaceAll("\n", "");
}

From source file:Main.java

static final String escape(String s) {
    return s.replaceAll("\"", "&quot;").replaceAll("'", "&apos").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
            .replaceAll("&", "&amp;");
}