src/org/nutz/lang/Files.java
public static String getMajorName(String path) {
        int len = path.length();
        int l = 0;
        int r = len;
        for (int i = r - 1; i > 0; i--) {
            if (r == len)
                if (path.charAt(i) == '.') {
                    r = i;
                }
            if (path.charAt(i) == '/' || path.charAt(i) == '\\') {
                l = i + 1;
                break;
            }
        }
        return path.substring(l, r);
    }
public static String getMajorName(String path) {
        int len = path.length();
        int l = 0;
        int r = len;
        for (int i = r - 1; i > 0; i--) {
            if (r == len)
                if (path.charAt(i) == '.') {
                    r = i;
                }
            if (path.charAt(i) == '/' || path.charAt(i) == '\\') {
                l = i + 1;
                break;
            }
        }
        return path.substring(l, r);
    }
public static String getMajorName ( String path ) { int len = path . length ( ) ; int l = 0 ; int r = len ; for ( int i = r - 1 ; i > 0 ; i -- ) { if ( r == len ) if ( path . charAt ( i ) == ' ' ) { r = i ; } if ( path . charAt ( i ) == ' ' || path . charAt ( i ) == ' ' ) { l = i + 1 ; break ; } } return path . substring ( l , r ) ; }
获取文件主名。 即去掉后缀的名称

@param path
文件路径
@return 文件主名
获取文件主名。 即去掉后缀的名称