List of utility methods to do String Sub String Get
String | subString(String str, int length) sub String if (isBlank(str)) { return ""; } else if (str.length() > length) { return str.substring(0, length); } else { return str; |
String | subInStringByFlag(String str, String flag) sub In String By Flag if (isBlank(str)) return null; StringBuffer sb = new StringBuffer(str); int index = str.lastIndexOf(flag); if (index < 0) { return str; } else { str = sb.delete(sb.length() - flag.length(), sb.length()) ... |
String | substringWithoutException(String text, int startIndex, int endIndex) substring Without Exception if (isNullOrEmpty(text) || startIndex >= text.length()) { return ""; final StringBuilder stringBuilder = new StringBuilder(); final int realEndIndex = endIndex >= text.length() ? text.length() - 1 : endIndex; for (int i = startIndex; i <= realEndIndex; i++) { stringBuilder.append(text.charAt(i)); ... |
String | subString(String str) sub String str = Html.fromHtml(str, null, null).toString(); String temp = String.valueOf(str.charAt(str.length() - 1)); if (temp.matches(E1)) { return str.substring(0, str.length() - 2); return str.substring(0, str.length() - 1); |
String | replace(String s, String oldSub, String newSub) replace if ((s == null) || (oldSub == null) || (newSub == null)) { return null; int y = s.indexOf(oldSub); if (y >= 0) { StringBuffer sb = new StringBuffer(); int length = oldSub.length(); int x = 0; ... |
String | replace(String s, String[] oldSubs, String[] newSubs) replace if ((s == null) || (oldSubs == null) || (newSubs == null)) { return null; if (oldSubs.length != newSubs.length) { return s; for (int i = 0; i < oldSubs.length; i++) { s = replace(s, oldSubs[i], newSubs[i]); ... |
String | substring(String str, int beginIndex) substring if (str == null) { return null; if (beginIndex < 0) { return EMPTY; if (beginIndex > str.length()) { return EMPTY; ... |
String | substring(String str, int beginIndex, int endIndex) substring if (str == null) { return null; if (beginIndex < 0 || endIndex < 0) { return EMPTY; if (endIndex > str.length()) { endIndex = str.length(); ... |
String | substringAfter(String str, String separator) substring After if (isEmpty(str)) { return str; if (separator == null) { return EMPTY; int beginIndex = str.indexOf(separator); if (beginIndex == INDEX_NOT_FOUND) { ... |
String | substringAfterLast(String str, String separator) substring After Last if (isEmpty(str)) { return str; if (isEmpty(separator)) { return EMPTY; int beginIndex = str.lastIndexOf(separator); if (beginIndex == INDEX_NOT_FOUND) { ... |