class Strings {

    public static String getDomain(String url) {
        String result = url;
        if (!isNullOrEmpty(url)) {
            int index = url.indexOf(SCHEME_HOST_SEPARATOR);
            if (index != INDEX_NOT_FOUND) {
                int slash = url.substring(index + SCHEME_HOST_SEPARATOR.length()).indexOf('/');
                if (slash != INDEX_NOT_FOUND) {
                    result = url.substring(0, index + slash + SCHEME_HOST_SEPARATOR.length());
                }
                int questionMark = url.substring(index + SCHEME_HOST_SEPARATOR.length()).indexOf('?');
                if (questionMark != INDEX_NOT_FOUND) {
                    result = url.substring(0, index + questionMark + SCHEME_HOST_SEPARATOR.length());
                }
            }
        }
        return result;
    }

    private  Strings();

}