Extract package name from canonical Java class name

@param fileNameWithoutExtension canonical class name (like 'a.b.c.SomeClassName'), must not be null
@return extracted package name, must not be null but can be empty
506121
@Nonnull
  public static String extractPackageName(@Nonnull final String fileNameWithoutExtension) {
    final int lastDot = fileNameWithoutExtension.lastIndexOf('.');
    if (lastDot < 0) {
      return "";
    }
    return fileNameWithoutExtension.substring(0, lastDot).trim();
  }
1159485
public static String getExtension(String fileName){
        int dot = fileName.lastIndexOf('.');
        return dot==-1 ? null : fileName.substring(dot+1);
    }
1125117
public static Class<? extends FileSystem> getFileSystemByName(final String className) throws ClassNotFoundException {
		return Class.forName(className, true, getClassLoader()).asSubclass(FileSystem.class);
	}
284787
public final String evalFileNameWithoutExtension(final String pPath) {
    int idxStart = 0;
    int idxEnd = pPath.length();
    int lastFs = pPath.lastIndexOf('/');
    if (lastFs == -1) {
      lastFs = pPath.lastIndexOf('\\');
    }
    if (lastFs != -1) {
      idxStart = lastFs + 1;
    }
    int idxDot = pPath.lastIndexOf('.');
    if (idxDot != -1) {
      idxEnd = idxDot;
    }
    return pPath.substring(idxStart, idxEnd);
  }
1257067
function getExtensionlessFilename( filename ) {
	return filename.substr( 0, filename.length - path.extname( filename ).length);
}
1033309
private String getExtension(String fileName) {
		if (fileName == null) {
            return null;
        }

		String ext = null;
		int i = fileName.lastIndexOf('.');

		if (i > 0 && i < fileName.length() - 1) {
			ext = fileName.substring(i + 1).toLowerCase();
		}
		return ext;
	}
321716
public static String getShortName(String className) {
		Assert.hasLength(className, "Class name must not be empty");
		int lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR);
		int nameEndIndex = className.indexOf(CGLIB_CLASS_SEPARATOR);
		if (nameEndIndex == -1) {
			nameEndIndex = className.length();
		}
		String shortName = className.substring(lastDotIndex + 1, nameEndIndex);
		shortName = shortName.replace(INNER_CLASS_SEPARATOR, PACKAGE_SEPARATOR);
		return shortName;
	}
196566
public static String getFilenameExtension(String name) {
    if(name == null) {
      return null;
    }
    int index = name.lastIndexOf('.');
    return index < 0 ? null : name.substring(index + 1).toLowerCase();
  }
680135
public static String extractPackage(String classname) {
    if (classname.contains("."))
      return classname.substring(0, classname.lastIndexOf("."));
    else
      return DEFAULT_PACKAGE;
  }
1014219
public static ClassName adapterName(ClassName type, String suffix) {
    return ClassName.get(type.packageName(),
        Joiner.on('$').join(type.simpleNames()) + suffix);
  }
282258
public String getFullPackageName(String classProjectID, String classPackageName)
    {
        if (classProjectID == null)
            return DBConstants.BLANK;
        String packageName = classProjectPackages.get(classProjectID);
        if (packageName == null)
            return null;    // This class is not accessible
        if (packageName.startsWith("."))
            packageName = Constants.ROOT_PACKAGE.substring(0, Constants.ROOT_PACKAGE.length() - 1) + packageName;
        if (classPackageName == null)
            classPackageName = DBConstants.BLANK;
        if (classPackageName.startsWith("."))
            packageName = packageName + classPackageName;
        else if (classPackageName.length() > 0)
            packageName = classPackageName;
        return packageName;
    }
587256
public static String getPackageName(String className, boolean resource)
   {
       String packageName = null;
       if (className != null)
       {
       	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;
   }
994351
public static String extractClassName(String fullName) {
		int l = fullName.lastIndexOf(".");

		return fullName.substring(l + 1);
	}
691676
public static String removeJavaPackageName(String className) {
        int idx = className.lastIndexOf('.');
        if (idx >= 0) {
            return className.substring(idx + 1);
        } else {
            return className;
        }
    }
585005
public String toClassName(final String filename) {
        return filename.substring(0, filename.lastIndexOf(".class"))
                .replace('/', '.').replace('\\', '.');
    }
569399
public static String getPackageName(final String className) {
        int dotPos = className.lastIndexOf('.');
        if (dotPos < 0) {
            return "";
        }
        return className.substring(0, dotPos);
    }
33188
public function getFilenameWithoutExtension()
    {
        $filename = $this->getDocument()->getFile()->getFilename();

        return substr($filename, 0, strrpos($filename, '.'));
    }