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 getIconAdd(String iconName) {
    return iconName.replaceAll("(?:.jpg|.JPG|.png|.PNG)", "s80x80.png");
}

From source file:Main.java

/**
 * Sanitise string for use as C identifier
 * //  www. j  av a 2 s .com
 * @param s String
 * 
 * @return Sanitised string
 */
static String sanitise(String s) {
    return s.replaceAll("/", "_");
}

From source file:Main.java

public static String removeCRLF(String parameter) {
    return parameter.replaceAll("\r", "").replaceAll("\n", "");
}

From source file:Main.java

public static String htmlEscape(String html) {
    return html.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
            .replaceAll(" ", "&nbsp;").replaceAll("'", "&#39;").replaceAll("\"", "&quot;")
            .replaceAll("\n", "<br/>");
}

From source file:Main.java

static public String delTwoLevelBoard(String content) {
    return content.replaceAll(TWO_LEVEL_BOARD_REGEX_STRING, "$1");
}

From source file:Main.java

private static String prepare(String unprepared) {
    return unprepared.replaceAll("\\s{2,}", "").replaceAll("\\n", "");
}

From source file:Main.java

/**
 * Replace the characters not allowed in file names with underscore
 * @param name/*from   ww w . j av  a2 s  . c o m*/
 * @return
 */
public static String escapeForFileSystem(String name) {
    return name.replaceAll("[\\\\/:*?\"<>|]+", "_");
}

From source file:Main.java

private static String deleteExcess(String xmlString) {
    return xmlString.replaceAll("(<region>).*(</region>)", "");
}

From source file:Main.java

/** Perform entity-quoting of quotes within attribute values. */
public static String quoteAttrValue(String s) {
    return "\"" + s.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("\'", "&apos;") + "\"";
}

From source file:Main.java

public static String removeQuote(String content) {
    return content.replaceAll(quoteRegex, "");
}