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 removeUnecessaryHtmlTag(String str) {
    return str.replace("<u>", "").replace("</u>", "").replace("<p dir=ltr>", "").replace("<p dir=\"ltr\">", "")
            .replace("<p>", "").replace("</p>", "").replace("<font color =\"#000000\">", "")
            .replace("</font>", "").trim();
}

From source file:Main.java

public static String saveDDFName(String ddfName) {
    return ddfName.replace("-", "_");
}

From source file:Main.java

/**
 * Correct some OCR errors in argument where only letters are expected.
 *///from w ww . j a va2s .  c o m
private static String fixOcrNumsToLetters(String src) {
    return src.replace("1", "l").replace("0", "o").replace("5", "s").replace("2", "z");
}

From source file:Main.java

private static String removeNoJSONPart(String response) {
    return response.replace("YAHOO.Finance.SymbolSuggest.ssCallback(", "").replace(")", "");
}

From source file:Main.java

public static String changeFilename(String filename) {
    return filename.replace('/', '|');
}

From source file:Main.java

public static String getCmdPath(String path) {
    return path.replace(" ", "\\ ").replace("'", "\\'");
}

From source file:Main.java

public static String convertAPIToHuman(String battleTag) {
    return battleTag.replace('-', '#');
}

From source file:Main.java

public static String convertHumanToAPI(String battleTag) {
    return battleTag.replace('#', '-');
}

From source file:Main.java

/**
 * Correct some OCR errors in argument where only numbers are expected.
 *//*from  w  ww.  j  ava2  s.c o m*/
private static String fixOcrLettersToNums(String src) {
    return src.replace("S", "5").replace("s", "5").replace("O", "0").replace("B", "8").replace("o", "0")
            .replace("l", "1").replace("I", "1").replace("i", "1").replace("Z", "2").replaceAll("[^0-9]", "");
}

From source file:Main.java

private static String trimEx(final String s) {
    return s.replace(NBSP, " ").trim();
}