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 entitize(String xml) {
    return xml.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
            .replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
}

From source file:Main.java

private static String packageNameToPath(final String packageName) {
    return packageName.replaceAll("[.]", "/");
}

From source file:Main.java

public static String toStandart(final String name) {
    String result = name.replaceAll("([a-z\\d])([A-Z])", "$1-$2").replace('_', '-');
    result = result.toLowerCase();//  ww w .j ava2 s .c om
    return result;
}

From source file:Main.java

private static String workAroundAfter(String origText) {
    return origText.replaceAll("XbllsHYBoPll", "#").replaceAll("XallsHYBoPll", "@");
}

From source file:Main.java

public static int findByValue(Activity activity, String value) {
    value = value.replaceAll("\\D", "_");
    value = "day_" + value;

    int id = activity.getResources().getIdentifier(value, "color", activity.getPackageName());

    int idColor = (id == 0) ? R.color.darker_gray : id;

    return activity.getResources().getColor(idColor);
}

From source file:Main.java

public static String removeXMLtags(String xml) {
    return xml.replaceAll("<.*?>", "");
}

From source file:Main.java

/**
 * Returns the given string with consecutive whitespace characters
 * replaced with a single space and then trimmed
 * @see http://www.rgagnon.com/javadetails/java-0352.html
 *//*from w w w.ja v  a 2 s  .co m*/
public static String trimAll(String str) {
    return str.replaceAll("\\s+", " ").trim();
}

From source file:Main.java

public static String escapeTagName(String name) {
    return name.replaceAll("\\.", "\\.\\.");
}

From source file:Main.java

public static String cleanEolnForXml(final String s) {
    return s.replaceAll("\\r", "");
}

From source file:Main.java

public static String getXmlEncodedApostrophes(String value) {
    return value.replaceAll("'", "&apos;");
}