List of utility methods to do String Sub String
String | substringL(String s, int i, int len) substring L String res = s.substring(i, Math.min(i + len, s.length()));
return res;
|
String | substringLinesWithTokenOfEOL(String originalString, String stringToBeInserted) Method to process String value with EOL mark StringBuffer processedString = new StringBuffer(); int lastEnd = 0; for (int i = 0; i <= originalString.length(); i++) { if (i + 5 <= originalString.length()) { if (originalString.substring(i, i + 5).equals("#EOL#")) { processedString.append(originalString.substring(lastEnd, i)); processedString.append(stringToBeInserted); lastEnd = i + 5; ... |
boolean | substringMatch(CharSequence str, int index, CharSequence substring) Test whether the given string matches the given substring at the given index. for (int j = 0; j < substring.length(); j++) { int i = index + j; if (i >= str.length() || str.charAt(i) != substring.charAt(j)) { return false; return true; |
boolean | substringMatch(CharSequence str, int index, CharSequence substring) substring Match for (int j = 0; j < substring.length(); j++) { int i = index + j; if (i >= str.length() || str.charAt(i) != substring.charAt(j)) { return false; return true; |
boolean | substringMatches(final String source, final String substring, final boolean checkBoundaries) substring Matches if (source == null) { return false; if (substring == null || substring.length() == 0) { return true; int index = source.indexOf(substring); if (index == -1) { ... |
String | substringMore(String s, int maxlen) substring More if (s.length() < maxlen) { return s; } else { return (maxlen < 3 ? "" : s.substring(0, maxlen - 3)) + "..."; |
String | subStringNobit(String str, int toCount, String more) sub String Nobit if (str != null) { if (str.getBytes().length > toCount) { return subStringByBytes(str, toCount, more); } else { return str; } else { return ""; ... |
String | subStringNotEncode(String subject, int size) sub String Not Encode if ((subject != null) && (subject.length() > size)) subject = subject.substring(0, size) + "..."; return subject; |
String | subStringRight(String str, int length) sub String Right if (str == null || str.isEmpty()) return str; return str.substring(str.length() - min(str.length(), length)); |
String | substrings(String str, int start, int end) substrings if (str == null) { return null; int length = end - start; byte[] dest = new byte[length]; System.arraycopy(str.getBytes(), start, dest, 0, length); return new String(dest); |