List of utility methods to do String Chop
String | chopId(String name) chop Id int id1in = name.indexOf('-'); String id1s = name.substring(id1in + 1); return id1s; |
void | chopIfMatch(StringBuilder sb, char ch) chop If Match if (sb.length() != 0 && sb.charAt(sb.length() - 1) == ch)
sb.setLength(sb.length() - 1);
|
String | chopLast(String value, int chars) CHOP LAST if (chars < 0 || chars > value.length()) throw new IllegalArgumentException("invalid chars: " + chars + " / " + value.length()); return value.substring(0, value.length() - chars); |
String | chopLenghtyString(String title, int maxLen) When the title is really long and without whitespaces it really messes up the ui. if (isBreakNeeded(title, maxLen)) { title = chopString(title, maxLen); return title; |
String | chopLongLinesAtSpaces(int maxLineLenght, String text) chop Long Lines At Spaces StringBuilder result = new StringBuilder(); int currentIndex = 0; while (currentIndex < text.length()) { int newLineIdx = text.indexOf("\n", currentIndex); String line; if (newLineIdx == -1) { line = text.substring(currentIndex); currentIndex = text.length(); ... |
String | chopNull(String str) chop Null if (str == null) { return ""; } else { return str; |
String | chopPrefix(String x, String prefix) chop Prefix if (x.startsWith(prefix)) return x.substring(prefix.length()); else return null; |
String | ChopRt(String this_string, String chomp_off) Chop Rt if (!this_string.contains(chomp_off)) return this_string; return this_string.substring(0, this_string.lastIndexOf(chomp_off)); |
String | chopScheme(String path) Chops the scheme/protocol from the given URL path and returns the path without the scheme. int idx = path.indexOf(":"); if (idx >= 0) { String toReturn = path.substring(idx + 1); if (toReturn.startsWith("//")) { toReturn = toReturn.substring(1); return toReturn; return path; |
String | chopScheme(String path) Chops the scheme/protocol from the given URL path and returns the path without the scheme. int idx = path.indexOf(":"); if (idx >= 0) { if (path.length() >= 2) { if (path.charAt(1) == ':') { if (Character.isLetter(path.charAt(0))) { return path; String toReturn = path.substring(idx + 1); if (toReturn.startsWith("//")) { toReturn = toReturn.substring(1); return toReturn; return path; |