Example usage for java.lang String replaceAll

List of usage examples for java.lang String replaceAll

Introduction

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

Prototype

public String replaceAll(String regex, String replacement) 

Source Link

Document

Replaces each substring of this string that matches the given regular expression with the given replacement.

Usage

From source file:Main.java

public static String replaceCode_dqm(String text) {
    text = null == text ? "" : text;
    return text.replaceAll("\"", "");
}

From source file:Main.java

public static String getGUID() {
    String uuid = UUID.randomUUID().toString();
    String guid = uuid.replaceAll("-", "").toLowerCase() + System.currentTimeMillis();
    return guid;/*from   w ww.ja va  2 s  . co m*/
}

From source file:Main.java

public static String gainUUID() {
    String strUUID = UUID.randomUUID().toString();
    strUUID = strUUID.replaceAll("-", "").toLowerCase();
    return strUUID;
}

From source file:Main.java

public static String replaceCode_bracket(String text) {
    text = null == text ? "" : text;
    return text.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\"", "");
}

From source file:com.jslsolucoes.tagria.lib.tag.x.StringUtil.java

public static String lineBreak(String value) {
    return value.replaceAll("\n", "<br>");
}

From source file:Main.java

private static String applyRule(String encoded, String toReplace, String replacement) {
    return encoded.replaceAll(Pattern.quote(toReplace), replacement);
}

From source file:Main.java

private static String formatModel(String model) {
    return model == null ? null
            : model.replaceAll("-", "").replaceAll("\\s", "").replaceAll("_", "").replaceAll("\\(", "")
                    .replaceAll("\\)", "").trim();
}

From source file:Main.java

/**
 * decode the string to <, >, </
 * @param text//from www.j  a  va 2s .  c o  m
 * @return
 */
public static String decodeString(String text) {
    String ret = null;
    ret = text.replaceAll("&lt;", "<");
    ret = ret.replaceAll("&gt;", ">");
    ret = ret.replaceAll("&apos;", "'");
    ret = ret.replaceAll("&quot;", "\"");
    ret = ret.replaceAll("&amp;", "&");
    return ret;
}

From source file:Main.java

public static String encodeXML(final String text) {
    String outText = text.replaceAll("&", "&amp;");
    outText = outText.replaceAll("<", "&lt;");
    outText = outText.replaceAll(">", "&gt;");
    outText = outText.replaceAll("'", "&apos;");
    outText = outText.replaceAll("\"", "&quot;");
    return outText;
}

From source file:Main.java

/**
 * escape characters like <, &, >
 * @param text//from ww w. j a  v a  2s  .  c o  m
 * @return
 */
public static String encodeString(String text) {
    String ret = null;
    ret = text.replaceAll("&", "&amp;");
    ret = ret.replaceAll("<", "&lt;");
    ret = ret.replaceAll(">", "&gt;");
    ret = ret.replaceAll("'", "&apos;");
    ret = ret.replaceAll("\"", "&quot;");
    return ret;
}