List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String trimFirstAndLastNewline(String source) { source = source.replaceAll("^(\\\\n)*", ""); source = source.replaceAll("(\\\\n)*$", ""); return source; }
From source file:Main.java
public static String breadcrumbsToPath(String breadcrumbs) { return breadcrumbs.replaceAll("\\s", ""); }
From source file:Main.java
public static String escapeURI(String uri) { uri = uri.replaceAll("&", "&"); uri = uri.replaceAll("'", "'"); uri = uri.replaceAll("\"", """); uri = uri.replaceAll(">", ">"); uri = uri.replaceAll("<", "<"); return uri;/*from www . jav a2 s . co m*/ }
From source file:Main.java
public static int getWordCountRegex(String s) { String t = s.replaceAll("[^\\x00-\\xff]", "**"); int length = t.length(); return length; }
From source file:Main.java
public static String generateUpDirectoriesFromPath(String baseDir) { baseDir = baseDir.replaceAll("[^/]*[^./][^/]*|[.]+[^/]", ".."); return baseDir; }
From source file:Main.java
public static String camelToLowerCase(final String camel) { return camel.replaceAll("(\\p{Ll})(\\p{Lu})", "$1_$2").toLowerCase(); }
From source file:Main.java
public static String escapeXml(String str) { str = str.replaceAll("&", "&"); str = str.replaceAll("<", "<"); str = str.replaceAll(">", ">"); str = str.replaceAll("\"", """); str = str.replaceAll("'", "'"); return str;//w w w . j ava 2s . c o m }
From source file:Main.java
public static String toXHTML(String html) { html = html.replaceAll("(?s)<script>.*?</script>", "<!-- removed scripts --!>"); final Document document = Jsoup.parse(html); document.outputSettings().syntax(Document.OutputSettings.Syntax.xml); return document.html(); }
From source file:Main.java
public static String fixText(String input) { input = input.replaceAll("&", "&"); input = input.replaceAll("'", "'"); input = input.trim();/*from w w w . j a va2s .com*/ return input; }
From source file:Main.java
private static String escapePath(String path) { String ep = path; ep = ep.replaceAll("\\!", "!!"); ep = ep.replaceAll("_", "!_"); ep = ep.replaceAll("%", "!%"); return ep;//from w w w . ja va 2 s . c o m }