class Strings {

    public static String getParent(String path) {
        String result = path;
        if (!isNullOrEmpty(path)) {
            if (!"/".equals(path)) {
                int lastSlash = path.lastIndexOf('/', path.length());
                if (lastSlash != INDEX_NOT_FOUND) {
                    if (lastSlash == 0) {
                        result = path.substring(0, 1);
                    } else {
                        result = path.substring(0, lastSlash);
                    }
                } else {
                    result = null;
                }
            }
        }
        return result;
    }

    private  Strings();

}