List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String getRandomUUID() { String uuidRaw = UUID.randomUUID().toString(); return uuidRaw.replaceAll("-", ""); }
From source file:com.aspose.utils.FormatExamples.java
public static String formatTitle(String inputStr) { String title = inputStr.replaceAll("(_|.java|\\.)", " "); title = title.replaceAll("([A-Z])", " $1"); title = WordUtils.capitalize(title); return title; }
From source file:Main.java
/** * Given text strings containing xml reserved characters, replace with valid xml representation characters > => & gt; * < => & lt; & => & amp; ' => & apos; " => & quot; * * @param text text to be converted to valid XML representation characters *//* w ww . j a va 2s . c om*/ public static String textToXml(String text) { if (text == null || text.equals("")) { return ""; } String str = text; str = str.replaceAll("&", "&"); str = str.replaceAll(">", ">"); str = str.replaceAll("<", "<"); str = str.replaceAll("'", "'"); str = str.replaceAll("\"", """); return str; }
From source file:Main.java
public static double[] parseDoubleArrayFromHeader(String lineFromHeader) { lineFromHeader = lineFromHeader.replaceAll(",$", ""); lineFromHeader = lineFromHeader.trim(); String[] splitLine = lineFromHeader.split("\\s*,\\s*"); double[] doubles = new double[splitLine.length]; for (int i = 0; i < doubles.length; i++) { doubles[i] = Double.parseDouble(splitLine[i]); }/*from w w w .j av a 2 s. c o m*/ return doubles; }
From source file:Main.java
public static short[] parseShortArrayFromHeader(String lineFromHeader) { lineFromHeader = lineFromHeader.replaceAll(",$", ""); lineFromHeader = lineFromHeader.trim(); String[] splitLine = lineFromHeader.split("\\s*,\\s*"); short[] shorts = new short[splitLine.length]; for (int i = 0; i < shorts.length; i++) { shorts[i] = Short.parseShort(splitLine[i]); }//from w w w .jav a2 s . c o m return shorts; }
From source file:Main.java
private static int countLength(@NonNull String string) { string = string.replaceAll("[^\\x00-\\xff]", "**"); return string.length(); }
From source file:Main.java
public static boolean isValidRouteName(String routeName) { return !isNullOrEmpty(routeName) && routeName.replaceAll(regExp, "_").equals(routeName); }
From source file:de.rallye.model.structures.AdditionalPicture.java
public static AdditionalPicture fromString(String s) { String pic = s.replaceAll("^picHash:(\\d+)$", "$1"); return new AdditionalPicture(pic); }
From source file:com.aspose.barcode.maven.utils.FormatExamples.java
/** * * @param inputStr/* w ww. j ava 2 s .co m*/ * @return */ public static String formatTitle(String inputStr) { String title = inputStr.replaceAll("(_|.java|\\.)", " "); title = title.replaceAll("([A-Z])", " $1"); title = WordUtils.capitalize(title); return title; }
From source file:Main.java
public static String stripXmlHeader(String string) { return string.replaceAll("<\\?xml.*?\\?>", ""); }