public static String subString(String string,int beginIndex,int length){
  if (string == null) {
    return null;
  }
  final int endIndex=beginIndex + length;
  if (beginIndex >= string.length()) {
    return EMPTY;
  }
  if (endIndex > string.length()) {
    return string.substring(beginIndex,string.length());
  }
  return string.substring(beginIndex,endIndex);
}

public static String subString ( String string , int beginIndex , int length ) { if ( string == null ) { return null ; } final int endIndex = beginIndex + length ; if ( beginIndex >= string . length ( ) ) { return EMPTY ; } if ( endIndex > string . length ( ) ) { return string . substring ( beginIndex , string . length ( ) ) ; } return string . substring ( beginIndex , endIndex ) ; }
gets the sub string of the given string . if the beginindex is larger than the length of the string , the empty string is returned . if the beginindex + the length is larger than the length of the string , the part of the string following the beginindex is returned . method is out - of - range safe .
