List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String removeAccents(CharSequence title) { String decomposed = Normalizer.normalize(title, Normalizer.Form.NFD); String removed = decomposed.replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); return removed; }
From source file:Main.java
/** * This method inserts the provided string, which should be formatted as XMLNote notes content (paragraphs, etc.) * at the top of the xmlnoteDocument. /* w ww . ja va2s. co m*/ * * @param xmlnoteDocument An XMLNote XML document. * @param xmlnoteText XMLNote notes content (paragraphs with text and markup). * @return string with the xmlnotetext inserted at the top. */ public static String insertXMLNoteTextAtTheTop(String xmlnoteDocument, String xmlnoteText) { xmlnoteDocument = xmlnoteDocument.replaceAll("[<]notes\\s+[/][>]", "<notes></notes>"); String[] txts = xmlnoteDocument.split("[<]notes[>]", 2); return txts[0] + "<notes>" + xmlnoteText + txts[1]; }
From source file:Main.java
@SuppressWarnings("nls") public static String encode(String exp) { if (exp != null) { String encoded = exp.replaceAll("&", "&"); encoded = encoded.replaceAll(">", ">"); encoded = encoded.replaceAll("<", "<"); encoded = encoded.replaceAll("\"", """); encoded = encoded.replaceAll("'", "'"); return encoded; }/*from w w w. j av a 2 s. co m*/ return ""; }
From source file:com.jdom.get.stuff.done.domain.TagFilterOption.java
public static FilterOption parse(String string) { String tagName = string.replaceAll(TAG_FILTER_PREFIX, ""); return new TagFilterOption(tagName); }
From source file:Main.java
/** * "Flattens" a phone number into a standard format by eliminating all symbols, etc. *///ww w . j ava2s . co m public static String flattenPhone(String formattedPhone) { String flattened = PhoneNumberUtils.stripSeparators(formattedPhone); flattened = flattened.replaceAll("\\+", ""); if (flattened.charAt(0) == '1') flattened = flattened.replaceFirst("1", ""); return flattened; }
From source file:Main.java
public static String toDescriptor(String type) { if (isPrimitiveType(type)) return type; return "L" + type.replaceAll("\\.", "/") + ";"; }
From source file:Main.java
public static String normalizeSpaces(final String text) { if (text == null) { return ""; }/* ww w . j a va 2 s . c om*/ return text.replaceAll("\\s{2,}", " "); }
From source file:Main.java
/** * make a string safe for json /*www. ja va 2 s .c o m*/ * **/ public static String safeJson(String in) { if (in == null) return null; return in.replaceAll("'", "").replaceAll("\n", ""); }
From source file:com.jdom.get.stuff.done.domain.ListFilterOption.java
public static FilterOption parse(String string) { String listName = string.replaceAll(LIST_FILTER_PREFIX, ""); return new ListFilterOption(listName); }
From source file:Main.java
public static String joinPath(String... args) { StringBuilder stringBuilder = new StringBuilder(); for (String arg : args) { stringBuilder.append(File.separator).append(arg.replaceAll("^/+", "")); }/*w ww .ja v a2 s .c o m*/ return stringBuilder.toString(); }