List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
/** * Tests if the given string is not null and contains at least one character that is not a space. * @param testString - the string to test * @return false if string is null or contains only spaces, true otherwise *//*w w w. j a v a2 s. c om*/ public static boolean isStringValue(String testString) { return (testString != null && testString.replace(" ", "").length() > 0); }
From source file:Main.java
public static String jG(String str) { if (str != null) { return str.replace('*', ' ').trim(); }//w ww . ja v a 2s .com return null; }
From source file:Main.java
/** * Fixes the file sperator char for the target platform * using the following replacement./* w w w . j ava 2 s . c o m*/ * * <ul> * <li> '/' ==> File.separatorChar * <li> '\\' ==> File.separatorChar * </ul> * * @param arg the argument to fix * @return the transformed argument */ public static String fixFileSeparatorChar(String arg) { return arg.replace(SLASH_CHAR, File.separatorChar).replace(BACKSLASH_CHAR, File.separatorChar); }
From source file:org.jongo.util.BsonUtil.java
public static String jsonify(String json) { return json.replace("'", "\""); }
From source file:Main.java
public static String format(String template, Object... values) { return String.format(template.replace("{}", "%s"), values); }
From source file:Main.java
public static void writeNode(BufferedWriter bw, String node) throws IOException { bw.write("\t" + node.replace("\n", "\n\t")); bw.newLine();/*from w ww . j a v a 2s .c o m*/ bw.newLine(); }
From source file:Main.java
public static String getFloatString2Decimal(float aFloatValue) { String ret = String.format("%.2f", aFloatValue); return ret.replace(',', '.'); }
From source file:Main.java
public static boolean isNumero(String valor) { String valorSemFormatacao = valor.replace(".", "").replace(",", ""); try {/* w w w .j a va 2s. c o m*/ Long.valueOf(valorSemFormatacao); } catch (NumberFormatException e) { return false; } return true; }
From source file:Main.java
public static Spanned stringToSpan(String src) { return src == null ? null : Html.fromHtml(src.replace("\n", "<br />")); }
From source file:Main.java
/** * To javascript text./* w w w.jav a2 s.c o m*/ * * @param src * the src * @return the string */ public static String ToJavascriptText(String src) { src = src.replace("\\", "\\\\"); src = src.replace("\n", "\\n"); src = src.replace("\r", "\\r"); src = src.replace("'", "\\'"); src = src.replace("\"", "\\\""); src = src.replace("\b", "\\b"); src = src.replace("\t", "\\t"); src = src.replace("\f", "\\f"); return src; }