List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:net.geoprism.util.EscapeUtil.java
public static String escapeHTMLAttribute(String value) { if (value != null) { String encoded = StringEscapeUtils.escapeHtml(value); encoded = encoded.replaceAll("'", "'"); encoded = encoded.replaceAll("/", "/"); return encoded; }//from w w w. j a v a 2 s. com return ""; }
From source file:Main.java
public static String replaceAll(String string, String notregex, String replacement) { return string.replaceAll(quote(notregex), quoteReplacement(replacement)); }
From source file:de.rallye.model.structures.LatLng.java
public static LatLng fromString(String location) { String[] res = location.replaceAll("^\\(([0-9\\.]+),([0-9\\.]+)\\)$", "$1;$2").split(";"); return new LatLng(Double.valueOf(res[0]), Double.valueOf(res[1])); }
From source file:com.enonic.cms.core.security.user.UsernameResolver.java
private static String stripBlankspaces(String resolvedUsername) { return resolvedUsername.replaceAll("\\s+", ""); }
From source file:com.thoughtworks.go.util.OperatingSystem.java
private static String cleanUpPythonOutput(String str) { String output = str.replaceAll("[()',]+", ""); if (StringUtils.isBlank(output)) { throw new RuntimeException("The linux distribution string is empty"); }//from w w w. j a v a 2s . co m return output; }
From source file:mase.jbot.PresetCreator.java
private static void fillWeights(File file, double[] weights) throws IOException { StringBuilder sb = new StringBuilder(); sb.append("weights=("); for (int i = 0; i < weights.length - 1; i++) { sb.append(weights[i]).append(","); }//from w w w.j a v a 2s .c om sb.append(weights[weights.length - 1]).append(")"); String descr = "description=(" + file.getName().replace("preset_", "").replace(".conf", "") + ")"; String content = IOUtils.toString(new FileInputStream(file)); content = content.replaceAll("weights\\s*=\\s*\\(.*\\)", sb.toString()); content = content.replaceAll("description\\s*=\\s*\\(.*\\)", descr); System.out.println("Writting: " + file.getAbsolutePath() + " " + weights.length + " weights."); IOUtils.write(content, new FileOutputStream(file)); }
From source file:Main.java
/** * Normalizes a URN by trimming whitespace, converting to lowercase, removing the prefix, * and all labels such as <i>partType=</i>. * /*www . j a v a2 s .co m*/ * @param urn the URN to normalize * @return the normalized URN */ static public String normalizeURN(String urn) { urn = urn.trim(); urn = urn.toLowerCase(); urn = urn.replaceAll(TOPO_ID_PREFIX + TOPO_ID_SEPARATOR, ""); for (String part : TOPO_ID_PARTS) { urn = urn.replaceAll(part + TOPO_ID_LABEL_SEPARATOR, ""); } return urn; }
From source file:Main.java
public static String encryptMessageToSend(String content) { if (content == null) { return null; }/*ww w .j a v a 2s. c o m*/ content = content.replaceAll("\"", "&dq"); content = content.replaceAll("\\\\", "&bs"); content = content.replaceAll("\n", "&nl"); return content; }
From source file:Main.java
private static String normalizeSelector(String selector) { while (selector.indexOf(" ") != -1) { selector = selector.replaceAll(" ", " "); }/*www . ja va 2s . co m*/ selector = selector.replaceAll(" \\+ ", "\\+"); selector = selector.replaceAll(" \\> ", "\\>"); return selector; }
From source file:Main.java
public static boolean stringIsEmpty(String text) { boolean isEmpty = true; if (text != null) { String tmp = text.replaceAll("\\s", ""); if (!tmp.isEmpty()) { isEmpty = false;/*from w ww . j a v a 2s. co m*/ } } return isEmpty; }