Java Class Name Convert To classNameToPackageName(String fqn)

Here you can find the source of classNameToPackageName(String fqn)

Description

class Name To Package Name

License

Open Source License

Declaration

public static String classNameToPackageName(String fqn) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final char FQN_SEPARATOR = '.';

    public static String classNameToPackageName(String fqn) {
        int lastSeparatorPos = fqn.lastIndexOf(FQN_SEPARATOR);
        if (lastSeparatorPos == -1)
            return null;
        else/* w w w .  j  a va 2s  .com*/
            return fqn.substring(0, lastSeparatorPos);
    }
}

Related

  1. classNameToFilePath(String className)
  2. classNameToFullyQualifiedClassName(String packageName, String className)
  3. classNameToInternalClassName(String className)
  4. classNameToJavaPath(String name)
  5. classNameToJavaUri(String className)
  6. classNameToPath(final String className)
  7. classNameToPath(String className)
  8. classNameToResource(String className)
  9. classNameToResource(String className)