The list of methods to do String Sub String are organized into topic(s).
String
substr(String s, int start, int end) substr
int length = s.length();
if (start < 0)
start += length;
if (end < start)
end += length;
end = Math.min(length, end);
return s.substring(start, end);
String
substr(String s, String sub, boolean before) substr
if (s == null)
throw new NullPointerException("s");
if (sub == null)
throw new NullPointerException("sub");
int index = indexOf(s, sub);
if (index == -1)
return null;
int sublen = sub.length();
...
String
substr(String src, int beginIndex, int endIndex) substr
String dest = "";
if (src == null) {
return dest;
byte[] srcByte = src.getBytes();
byte[] destByte = null;
int srclen = srcByte.length;
if (srclen <= beginIndex || beginIndex >= endIndex) {
...
String
substr(String src, int nStart, int nLen) substr
if (src == null)
return null;
byte[] bySrc = src.getBytes();
byte[] byRet = new byte[nLen];
int i, j;
for (i = nStart, j = 0; i < bySrc.length && j < nLen; i++, j++)
byRet[j] = bySrc[i];
return new String(byRet, 0, j);
...
String
subStr(String src, String split) sub Str
if (!(isEmpty(src))) {
int index = src.indexOf(split);
if (index >= 0)
return src.substring(0, index);
return src;
String
substr(String str, int iLen) we'll cut it if the length of the specify string longer than specify length
if (str == null)
return "";
if (iLen > 2) {
if (str.length() > iLen - 2) {
str = str.substring(0, iLen - 2) + "..";
return str;
...