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 GetName(int s, int t) {
    String seal = seals[s][0];
    seal = seal.replace(" ", " " + tones[t][0] + " ");
    return seal;/*from   w  ww .  j av  a 2 s  .com*/
}

From source file:Main.java

public static String revertUsername2PhoneNumber(String stringExtra) {
    //TODO: later
    String number = stringExtra.replace('p', '+');
    //      return number;
    return number.substring(0, number.indexOf('@'));
}

From source file:net.pot8os.heartbleedchecker.HexUtil.java

public static byte[] hex2bin(String input) {
    input = input.replace(" ", "");
    return DatatypeConverter.parseHexBinary(input);
}

From source file:Main.java

public static String replaceEmail(String pStr) {
    if (pStr.contains("#")) {
        return pStr.replace("#", "@");
    }//w w w.ja  va2  s .  c o  m
    return pStr;
}

From source file:Main.java

public static String extractHash(String data) {
    int i = data.indexOf("::::");
    String hash = data.substring(0, i + "::::".length());
    hash = hash.replace(":", "");
    return hash;//from w  w w . j a v  a  2s.  c  o m
}

From source file:Main.java

public static double moneyToDouble(String value) {
    try {//from   w ww  .  j  a va2s.  co  m
        return Double.parseDouble(value.replaceAll("\\.", "").replaceAll(",", ".").replace("R$", ""));
    } catch (Exception e) {
        return 0;
    }
}

From source file:Main.java

public static String SPF(String str) {
    if (null != str) {
        String tmp = str.replace("'", "''");
        return "'" + tmp + "'";
    } else {//from w  ww  . j  av a 2  s.c o  m
        return "null";
    }
}

From source file:FileUtils.java

public static String getFilePath(String name) {
    return name != null ? name.replace(SEPARATOR, '/') : "";
}

From source file:Main.java

/**
 * format "' 1'" to "_1" /*from   w  w  w. ja  va 2  s.  c  o m*/
 * 
 * @param cirId
 * @return
 */
public static String formatCircuitId(String cirId) {
    String s = cirId.replace(' ', '_');
    return removeSingleQuote(s);
}

From source file:Main.java

public static double getDoubleAttribute(Element node, String attr) {
    double retValue = 0;
    try {//from  w ww .j av  a  2  s .  c  o m
        String s = node.getAttribute(attr);
        s = s.replace(',', '.');
        //retValue = Double.parseDouble( s );
        retValue = Double.valueOf(s).doubleValue();
    } catch (NumberFormatException ex) {
        System.err.println("Parse error:" + ex.getMessage() + " while reading attr: " + attr);
        lastState = ERROR;
    }
    return retValue;
}