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 getDataFromReturnUrl(String url) {
    String temp = url.replace(PANDO_RETURN_DATA, EMPTY_STR);
    String[] fuctionAndData = temp.split(SPLIT_MARK);
    if (fuctionAndData != null && fuctionAndData.length >= 1) {
        return fuctionAndData[0];
    }//from w w  w. j  a  v a  2s .  c  o  m
    return null;
}

From source file:Main.java

private static int getVersionAsNumber(@NonNull String version) {
    version = version.replace(".", "");
    return Integer.valueOf(version);
}

From source file:Main.java

/**
 * Convert a "."-based fully qualified class name to a "/"-based resource path.
 * /*from w w w . j  a v a2 s .  c  om*/
 * @param className
 *          the fully qualified class name
 * @return the corresponding resource path, pointing to the class
 */
public static String convertClassNameToResourcePath(String className) {
    return className.replace('.', '/');
}

From source file:Main.java

/**
 * Returns an unqualified version of the given file path.
 *//*w  ww . j  av  a  2 s. co  m*/
private static String unqualify(String path) {
    path = path.replace('\\', '/');
    return path.substring(path.lastIndexOf('/') + 1);
}

From source file:Main.java

public static String shellQuote(String text) {
    return "'" + text.replace("'", "'\"'\"'") + "'";
}

From source file:Main.java

public static String handlerString(String introduction) {
    String newString = introduction.replace("\n", "\n\t\t");
    return newString;
}

From source file:Main.java

/**
 * Convert double quotes to single quotes.
 * <p>/*from  w  ww.  j  a va  2  s . c o  m*/
 * This method is a simple replace function call. It does not check if the xml contains a mixture of single and
 * double quotes. In that instance the returned XML will break.
 *
 * @param xml
 *            the xml
 * @return the converted xml
 */
public static String convertQuotes(String xml) {
    return xml.replace('"', '\'');
}

From source file:createbulksubdomainconfig.CreateBulkSubdomainConfig.java

protected synchronized static String getHtAccessFileContent(String strFolderName) {
    String strTemp = mHtAccess;
    return strTemp.replace("{{rewrite_base}}", strFolderName);
}

From source file:Main.java

public static String replaceContent(String strTemplate, String content) {
    return strTemplate.replace("%d", content);
}

From source file:Main.java

public static String sqliteEscape(String keyWord) {
    keyWord = keyWord.replace("/", "//");
    keyWord = keyWord.replace("'", "''");
    keyWord = keyWord.replace("[", "/[");
    keyWord = keyWord.replace("]", "/]");
    keyWord = keyWord.replace("%", "/%");
    keyWord = keyWord.replace("&", "/&");
    keyWord = keyWord.replace("_", "/_");
    keyWord = keyWord.replace("(", "/(");
    keyWord = keyWord.replace(")", "/)");
    return keyWord;
}