public static String getPrefix(String s) {
        int dot = s.lastIndexOf(".");
        if (dot == -1) {
            return s;
        } else {
            return s.substring(0, dot);
        }
    }
public static String getPrefix ( String s ) { int dot = s . lastIndexOf ( "." ) ; if ( dot == - 1 ) { return s ; } else { return s . substring ( 0 , dot ) ; } }
blabla.ahah.ohoh --> blabla