class TextUtils {

    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 );
    }

}