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

public static String getLinuxPath(String path) {
    return path.replace("\\", "/");
}

From source file:Main.java

public static String decodeUrlParam(String param) {
    return param.replace("%%", "/");
}

From source file:Main.java

public static String encodeUrlParam(String param) {
    return param.replace("/", "%%");
}

From source file:Main.java

/**
 * Creates a dotted class name from a path/package name
 *///from  w  ww.  j  av  a  2  s  . co m
public static String c(String p) {
    return p.replace('/', '.');
}

From source file:Main.java

public final static String escapedXml(String string) {
    return string.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
}

From source file:Main.java

public static long ConvertMacToLong(String mac) {
    mac = mac.replace(":", "");
    long id = Long.parseLong(mac, 16);
    return id;/*from   w w w  .  java2  s  . c o m*/
}

From source file:Main.java

public static final String encodeCdata(String xml) {
    return xml.replace(CDATA_CLOSE, CDATA_CLOSE_ENCODE);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static String stripBOM(String string) {
    return string.replace("\uFEFF", "");
}