List of utility methods to do String Sub String
String | substringBetweenStrings(String within, String pre, String post) substring Between Strings int from = within.indexOf(pre); if (from < 0) return null; from += pre.length(); int to = within.indexOf(post, from); if (to < 0) return null; return within.substring(from, to); ... |
String | subStringByByte(String orignal, int subcount) sub String By Byte int reInt = 0; String reStr = ""; if (orignal == null) return ""; char[] tempChar = orignal.toCharArray(); for (int kk = 0; (kk < tempChar.length && subcount > reInt); kk++) { String s1 = orignal.valueOf(tempChar[kk]); byte[] b = s1.getBytes(); ... |
String | subStringByByte(String str, int byteLenth) sub String By Byte if (str == null || "".equals(str)) return str; if (byteLenth <= 0) return str; byte[] bs = str.getBytes(); if (bs.length <= byteLenth) return str; int templengh = 0; ... |
String | substringByByteCount(String str, int byteCount) substring By Byte Count byte[] bytes = str.getBytes(); if (bytes.length <= byteCount) { return str; int strIndex = 0; for (int i = 0; i < bytes.length;) { int len = utf8Len(bytes[i]); if (i + len <= byteCount) { ... |
String | subStringByBytes(String str, int toCount, String more) sub String By Bytes int reInt = 0; StringBuilder reStr = new StringBuilder(); char[] tempChar = str.toCharArray(); for (int kk = 0; kk < tempChar.length; kk++) { char c = tempChar[kk]; byte[] b = String.valueOf(c).getBytes(); reInt += b.length; if (toCount >= reInt) { ... |
String | substringByCodePoint(String inputStr, int codePointStart, int codePointEnd) Returns a substring of the input string based on the input code points int charOffsetStart = convertCodePointOffsetToCharOffset(inputStr, codePointStart); int charOffsetEnd = convertCodePointOffsetToCharOffset(inputStr, codePointEnd); return inputStr.substring(charOffsetStart, charOffsetEnd); |
String | substringByMask(String baseString, String baseMask, String subMask) substring By Mask if ((baseString == null) || (baseMask == null) || (subMask == null)) { return null; } else if (isEmpty(baseString)) return baseString; else { String ls_Return = ""; int li_Pos = 0; while (li_Pos >= 0) { ... |
String | subStringByte(String str, int toCount, String more) sub String Byte if (str != null && toCount > 0) { if (str.length() > toCount) { str = str.substring(0, toCount - 1) + more; return str; } else { return ""; |
String | substringBytes(String value, int byte_len) substring Bytes int retLength = 0; int tempSize = 0; for (int index = 1; index <= value.length(); index++) { int asc = value.charAt(index - 1); if (asc > 127) { if (byte_len >= tempSize + 2) { tempSize += 2; retLength++; ... |
boolean | substringCompare(String string, int index, char... characters) Check if the given character sequence is located in the given string at the specified index. if (string.length() <= index + characters.length) return false; for (char character : characters) { if (string.charAt(index) != character) return false; index++; return false; ... |