List of utility methods to do String Extract
String[] | extractParameters(String uri) extract Parameters List<String> params = new ArrayList<String>(); StringBuilder param = new StringBuilder(); int brackets = 0; for (int i = 0; i < uri.length(); i++) { char character = uri.charAt(i); if (character == '{') { brackets++; if (brackets == 1) { ... |
List | extractParamsFromUriTemplateFragment(String value) Extracts all the character sequences inside of curly braces ('{' and '}') and returns them as a list of strings List<String> params = new ArrayList<String>(); int beginIndex = -1; while ((beginIndex = value.indexOf("{", beginIndex + 1)) != -1) { int semicolonIndex = value.indexOf(":", beginIndex); int closingCurlyBraketIndex = value.indexOf("}", beginIndex); int endIndex = (semicolonIndex != -1) ? Math.min(semicolonIndex, closingCurlyBraketIndex) : closingCurlyBraketIndex; if (endIndex == -1) { ... |
String[] | extractReferences(String value) extract References List l = new ArrayList(); for (int i = 0; i < value.length(); i++) if ('$' == value.charAt(i)) { int start = i + 2; while ('}' != value.charAt(i)) i++; int end = i; l.add(value.substring(start, end)); ... |
String | extractStreetName(String address) extract Street Name String[] parts = address.split("\\s"); for (int i = parts.length - 1; i >= 0; i--) { String part = parts[i]; if (part.length() > 3 && !part.contains("/") && !part.matches(".*\\d.*")) { return String.join(" ", Arrays.copyOfRange(parts, 0, i + 1)); return ""; ... |
List | extractStrings(String s) extract Strings List strings = new ArrayList(); if (s == null || s.equals("")) { return strings; try { while (s.indexOf(STRING_SEPARATOR) != -1) { int nIndex = s.indexOf(STRING_SEPARATOR); strings.add(s.substring(0, nIndex)); ... |
List | extractStringsAroundDots(String s) Example: "1.3" => a list that contains "1" and "3" List result = new ArrayList(); int pos = 0; while (s.indexOf('.', pos) >= 0) { int nextPos = s.indexOf('.', pos) + 1; result.add(s.substring(pos, nextPos - 1)); pos = nextPos; result.add(s.substring(pos)); ... |
String | extractTableName(String line) extract Table Name List<Integer> indices = getQuotePositions(line); if (indices.size() < 4) { return ""; return line.substring(indices.get(0), indices.get(3) + 1); |
List | extractTags(Map extract Tags String tagsStr = layoutProperties.get(LAYOUT_PROPERTY);
return convertTagStringToTag(tagsStr);
|
List | extractUmiPositions(String pattern) extract Umi Positions List<Integer> umiPositions = new ArrayList<>(); for (int i = 0; i < pattern.length(); i++) { if (pattern.charAt(i) == UMI_BASE) { umiPositions.add(i); return umiPositions; |
String[] | extractWords(String s) extract Words ArrayList<String> words = new ArrayList<>(); StringBuilder b = new StringBuilder(); char prev = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isAlphabetic(c) || Character.isDigit(c)) { if ((!(Character.isLowerCase(c) && Character.isUpperCase(prev))) && ((Character.isUpperCase(c) && !Character.isUpperCase(prev)) ... |