List of utility methods to do String Chop
String | chop(String str) Remove the last char in a string return str.substring(0, str.length() - 1);
|
String | chop(String str) chop return (str != null && str.length() > 0) ? str.substring(0, str.length() - 1) : str;
|
String | chop(String str) chop if (str == null) { return null; int strLen = str.length(); if (strLen < 2) { return ""; int lastIdx = strLen - 1; ... |
String | chop(String str) Remove the last character from a String. if (str == null) { return null; int strLen = str.length(); if (strLen < 2) { return EMPTY; int lastIdx = strLen - 1; ... |
String | chop(String str) Remove the last character from a String. If the String ends in StringUtils.chop(null) = null StringUtils.chop("") = "" StringUtils.chop("abc \r") = "abc " StringUtils.chop("abc\n") = "abc" StringUtils.chop("abc\r\n") = "abc" StringUtils.chop("abc") = "ab" StringUtils.chop("abc\nabc") = "abc\nab" StringUtils.chop("a") = "" StringUtils.chop("\r") = "" StringUtils.chop("\n") = "" StringUtils.chop("\r\n") = "" if (str == null) { return null; int strLen = str.length(); if (strLen < 2) { return EMPTY; int lastIdx = strLen - 1; ... |
String | chop(String str, int maxLength) Truncate a string to a maximum length. return (str.length() > maxLength) ? str.substring(0, maxLength) : str;
|
String[] | chop(String string, int length) chop up strings to chunks of the specified length (last chunk may be shorter) if (string.length() == 0) { return new String[0]; int chunkCount = string.length() / length + 1; String[] chunks = new String[chunkCount]; for (int i = 0; i < chunkCount; i++) { chunks[i] = string.substring(i * length, Math.min(string.length(), (i + 1) * length)); return chunks; |
String | chop(String string, int length) chop if (string == null) return null; if (length <= 0) throw new IllegalArgumentException("Length must be > 0"); if (string.length() <= length + 2) { return string; } else { StringBuffer buf = new StringBuffer(string.substring(0, length)); ... |
String[] | chop(String value, int size) CHOP int fullParts = value.length() / size; int extra = ((value.length() % size) != 0) ? 1 : 0; String[] part = new String[fullParts + extra]; for (int i = 0; i < fullParts; i++) part[i] = value.substring(i * size, (i + 1) * size); if (extra != 0) part[fullParts] = value.substring(fullParts * size); return part; ... |
String | chop(String x) chop if (x.length() == 0) return x; return x.substring(0, x.length() - 1); |