Example usage for java.lang String replace

List of usage examples for java.lang String replace

Introduction

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

Prototype

public String replace(CharSequence target, CharSequence replacement) 

Source Link

Document

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.

Usage

From source file:Main.java

/**
 * To escape characters that can not be used in the file name from the URI.
 * /*from ww w  . j  a v a 2 s .c  om*/
 * @param uri
 * @return
 */
private static String escapeUri(String uri) {
    return uri.replace("://", "_").replace("/", "_");
}

From source file:Main.java

public static String xmlDecode(String string) {

    return string.replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "\"").replace("&lt;", "<")
            .replace("&gt;", ">");
}

From source file:Main.java

public static String separator(String path) {
    path = path.replace('\\', '/');
    if (!path.endsWith("/"))
        path = path + "/";
    return path;//from  www. jav  a  2  s. co  m
}

From source file:Main.java

public static String replaceInvalidCharacters(String data) {
    data = data.replace("\u010D", "c");
    data = data.replace("\u010C", "C");

    return data;//from  w  w w.  j  ava  2  s.c om
}

From source file:Main.java

public static String convertPackageName2Apk(String packageName) {
    return packageName.replace(".", "_") + ".apk";
}

From source file:Main.java

public static String parseFunctionName(String paramString) {
    return paramString.replace("javascript:WemartJSBridge.", "").replaceAll("\\(.*\\);", "");
}

From source file:Main.java

public static String convertPackageName2Script(String packageName) {
    return packageName.replace(".", "_") + ".txt";
}

From source file:Main.java

static String UnescapeHTML(String html) {
    html = html.replace("&lt;", "<");
    html = html.replace("&gt;", ">");
    html = html.replace("&quot;", "\"");
    html = html.replace("&amp;", "&");
    return html;//w w  w.j a v  a  2  s  .c  o m
}

From source file:Main.java

public static String escapeElementValue(String unescaped) {
    return unescaped.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("'", "&apos;")
            .replace("\"", "&quot;");
}

From source file:Main.java

public static String decodeEmail(String encodedEmail) {
    return encodedEmail.replace(",", ".");
}