public static String getPackageName(String className, boolean resource)
    {
        String packageName = null;
        if (className != null)
        {
            if (className.indexOf(File.separator) != -1)
            {
                className = className.substring(0, className.lastIndexOf(File.separator));
                packageName = className.replace(File.separator.charAt(0), '.');
            }
            else if (className.indexOf('/') != -1)
            {
                className = className.substring(0, className.lastIndexOf('/'));
                packageName = className.replace('/', '.');
            }
            else
            {
                if (resource)
                    if (className.endsWith(PROPERTIES))
                        className = className.substring(0, className.length() - PROPERTIES.length());
                if (className.lastIndexOf('.') != -1)
                    packageName = className.substring(0, className.lastIndexOf('.'));
            }
        }
        return packageName;
    }
public static String getPackageName ( String className , boolean resource ) { String packageName = null ; if ( className != null ) { if ( className . indexOf ( File . separator ) != - 1 ) { className = className . substring ( 0 , className . lastIndexOf ( File . separator ) ) ; packageName = className . replace ( File . separator . charAt ( 0 ) , '.' ) ; } else if ( className . indexOf ( '/' ) != - 1 ) { className = className . substring ( 0 , className . lastIndexOf ( '/' ) ) ; packageName = className . replace ( '/' , '.' ) ; } else { if ( resource ) if ( className . endsWith ( PROPERTIES ) ) className = className . substring ( 0 , className . length ( ) - PROPERTIES . length ( ) ) ; if ( className . lastIndexOf ( '.' ) != - 1 ) packageName = className . substring ( 0 , className . lastIndexOf ( '.' ) ) ; } } return packageName ; }
Get the package name of this class name.
NOTE: This is exactly the same as Util.getPackageName, move this!
@param className
@return