Java Utililty Methods String Sub String

List of utility methods to do String Sub String

  1. HOME
  2. Java
  3. S
  4. String Sub String

Description

The list of methods to do String Sub String are organized into topic(s).

Method

byte[] substr(byte[] i_Value, int i_BeginIndex)
substr
return substr(i_Value, i_BeginIndex, i_Value.length - i_BeginIndex);
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 len)
sub Str
if (src.length() <= len)
 return src;
return src.substring(0, len - 1);
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 beginIndex, int endIndex)
substr
if (isBlank(str)) {
 return "";
if (endIndex == -1) {
 return str.substring(beginIndex);
if (endIndex > str.length()) {
 endIndex = str.length();
...
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;
...
String substr(String str, int index)
substr
if (str.length() < index) {
 return str;
str = trim(str).substring(index);
return str;


AltStyle によって変換されたページ (->オリジナル) /