Get the file name extension from its name.
@param filename the filename.
@return the file name extension.
558751
private static String getFileExtension(final String filename) {

		String extension = "";
		int i = filename.lastIndexOf('.');
		int p = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
		if (i > p)
			extension = filename.substring(i+1);

		return extension;
	}
317649
public static String getFullPath(String filename) {
        if (filename == null) {
            return null;
        }
        int index = indexOfLastSeparator(filename);
        if (index < 0) {
            return StringUtils.EMPTY;
        }
        return filename.substring(0, index);
    }
1124116
public static String getExtension(File file)
    {
        Check.notNull(file);

        return getExtension(file.getName());
    }
1000162
private String getIdFromFilename(String filename) {
        if (!StringUtils.hasText(filename) || filename.indexOf('_') < 0) {
            return null;
        }
        return filename.substring(0, filename.lastIndexOf('_'));
    }
476712
public static String getImageFileName(String originalFilename) {
    String namePart = StringUtils.substringBeforeLast(originalFilename, ".");
    String extensionPart = StringUtils.substringAfterLast(originalFilename, ".");

    // use PNG format if original image is PNG, otherwise always use JPEG
    if (StringUtils.equalsIgnoreCase(extensionPart, FileExtension.PNG)) {
      extensionPart = FileExtension.PNG;
    }
    else {
      extensionPart = FileExtension.JPEG;
    }
    return namePart + "." + extensionPart;
  }
616119
public static String getExtensionNameNoAuthor(String extensionName) {
		String value = null;
		if (extensionName != null) {
			value = extensionName.substring(
					extensionName.indexOf(EXTENSION_NAME_DIVIDER) + 1,
					extensionName.length());
		}
		return value;
	}
966281
public static String getScriptEngineName(String filename) {
        String extension = FilenameUtils.getExtension(filename);
        if (StringUtils.isBlank(extension)) {
            logger.warn("Can't determine engine name based on filename without extension {}",filename);
            return null;
        }
        ScriptEngineManager manager = new ScriptEngineManager();
        List<ScriptEngineFactory> engines = manager.getEngineFactories();
        for (ScriptEngineFactory engineFactory : engines) {
            List<String> extensions = engineFactory.getExtensions();
            for (String supportedExt : extensions) {
                if (extension.equals(supportedExt)) {
                    // return first short name
                    return engineFactory.getNames().get(0);
                }
            }
        }
        logger.warn("Can't determine engine name based on filename and available script engines {}",filename);
        return null;
    }
151793
public static String getFileExtension(File file) {

		String fileName = file.getName();
		String extension = null;

		int extensionIndex = fileName.lastIndexOf(".");
		if (extensionIndex > -1) {
			extension = fileName.substring(extensionIndex + 1);
		}

		return extension;
	}
485239
public function getFilename()
	{
		$filename = $this->getDisplayName();
		if ($this->getExtension() != '')
		{
			$filename .= '.' . $this->getExtension();
		}
		return $filename;
	}
338056
public static String getExtension(String resourceName) {

        String result = null;
        if (!resourceName.endsWith("/")) {
            // folders don't have any extension
            resourceName = CmsResource.getName(resourceName);
            int index = resourceName.lastIndexOf(".") + 1;
            if ((index > 0) && (index < resourceName.length())) {
                result = resourceName.substring(index).toLowerCase();
            }
        }

        return result;
    }
1320585
public static String getExtension(String fileName) {
		if (fileName==null){
			return null;
		} else {
			int number=fileName.lastIndexOf('.');
			
			if (number>=0){
				return fileName.substring(number+1, fileName.length());
			} else {
				return null;
			}
		}		
	}
407983
def extension(filename):
    ''''''
    filename = os.path.basename(filename)
    extension = None

    while '.' in filename:
        filename, ext = os.path.splitext(filename)
        if ext.startswith('.'):
            ext = ext[1:]
        extension = ext if not extension else ext + '.' + extension

    return extension
1141298
public static String getFileExtension(String _fileName) {
        if (_fileName == null) {
            return null;
        }
        int lastDot = _fileName.lastIndexOf('.');
        if (lastDot == -1) {
            return "";
        }
        return _fileName.substring(lastDot + 1);
    }
297724
@Pure
	public static File removeExtension(File filename) {
		if (filename == null) {
			return null;
		}
		final File dir = filename.getParentFile();
		final String name = filename.getName();
		final int idx = name.lastIndexOf(getFileExtensionCharacter());
		if (idx < 0) {
			return filename;
		}
		return new File(dir, name.substring(0, idx));
	}
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();
  }
149783
public static String getExtension(String fileName) {
        int dotIndex = fileName.lastIndexOf(DOT);
        return dotIndex > 0 ? fileName.substring(dotIndex) : EMPTY;
    }
253228
@Pure
	public static String extension(File filename) {
		if (filename == null) {
			return null;
		}
		final String largeBasename = largeBasename(filename);
		final int idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
		if (idx <= 0) {
			return ""; //$NON-NLS-1$
		}
		return largeBasename.substring(idx);
	}