List of utility methods to do String Sub String
String | substringBeforeLast(String str, String separator) Gets the substring before the last occurrence of a separator. if (isEmpty(str) || isEmpty(separator)) { return str; int pos = str.lastIndexOf(separator); if (pos == -1) { return str; return str.substring(0, pos); ... |
String | substringBeforeLast(String str, String separator) substring Before Last if (str == null || separator == null || str.length() == 0 || separator.length() == 0) { return str; int pos = str.lastIndexOf(separator); if (pos == -1) { return str; return str.substring(0, pos); ... |
String | subStringBeforeLast(String str, String separator) returns string before last entry of separator in case string doesn't contain separator -- returns whole string int from = str.lastIndexOf(separator); return from == -1 ? str : str.substring(0, from); |
String | substringBeforeLast(String text, String separator) substring Before Last int index = lastIndexOf(text, separator); return substringBefore(text, index); |
String | substringBeforeLastChar(String str, String separator) substring Before Last Char if (isEmpty(str) || isEmpty(separator)) { return str; int pos = str.lastIndexOf(separator); if (pos == INDEX_NOT_FOUND) { return str; if (pos == 0) { ... |
String | substringBeforeLastIgnoreCase(final String target, final String separator) substring Before Last Ignore Case if ("".equals(target)) return target; if ("".equals(separator)) return target; final String tempStr = target.toUpperCase(); final String tempSeparator = separator.toUpperCase(); final int index = tempStr.lastIndexOf(tempSeparator); if (index == -1) ... |
String | substringBetween(final String s, final String tag) Gets the String that is nested in between two instances of the same String. return substringBetween(s, tag, tag);
|
String | substringBetween(final String str, final String startToken, final String endToken) substring Between int firstToken = str.indexOf(startToken) + 1; int secondToken = str.indexOf(endToken, firstToken); firstToken = firstToken < 0 ? 0 : firstToken; secondToken = secondToken < 0 ? 0 : secondToken; return str.substring(firstToken, secondToken); |
String | substringBetween(String line, final String delimiterBefore, final String delimiterAfter) substring Between final int indexAfterFirstFromChar = line.indexOf(delimiterBefore) + 1; final int firstIndexOfToChar = line.indexOf(delimiterAfter, indexAfterFirstFromChar); return line.substring(indexAfterFirstFromChar, firstIndexOfToChar); |
String | substringBetween(String s, String part1, String part2) Returns the first instance of String found exclusively between part1 and part2. String sub = null; int i = s.indexOf(part1); int j = s.indexOf(part2, i + part1.length()); if (i != -1 && j != -1) { int nStart = i + part1.length(); sub = s.substring(nStart, j); return sub; ... |