Sanitizes file extension such that it can be used in the Windows
Registry.

@param fileTypeExtension Extension to sanitize
@return Sanitized file extension
@throws OSException If the file extension is malformed
429890
protected static String sanitizeFileExtension(String fileTypeExtension) throws OSException {
        // Remove whitespaces
        String newFileTypeExtension = fileTypeExtension.replaceAll("\\s+", "");

        // to lower case
        newFileTypeExtension = newFileTypeExtension.toLowerCase();

        /*
         * Check if name contains multiple dots and if so, just take the last
         * part. Also adds a dot before last part.
         */
        String[] splittedFileExtension = newFileTypeExtension.split("\\.");
        if (newFileTypeExtension.length() == 0 || splittedFileExtension.length == 0) {
            throw new OSException("The given file extension \"" + fileTypeExtension + "\" is too short.");
        }
        newFileTypeExtension = "." + splittedFileExtension[splittedFileExtension.length - 1];

        return newFileTypeExtension;
    }
347432
protected function fileExtension()
    {
        if (!$this->fileExtension) {
            $mimeType = $this->serializer->mimeType();
            $this->fileExtension = $this->mimetypes->fileExtensions($mimeType)[0];
        };
        return $this->fileExtension;
    }
708677
public static void registerArchiveFileProvider(Class<? extends IArchiveFile> provider, String fileExtension){
		extensionMap.put(fileExtension, provider);
	}
311666
public static String getExtension(final String filename) {
        Objects.requireNonNull(filename, "filename cannot be null");
        int lastDotIdx = filename.lastIndexOf(".");
        return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : "";
    }
1290563
public void removeExtension(DefaultLocalExtension extension) throws IOException
    {
        File descriptorFile = extension.getDescriptorFile();

        if (descriptorFile == null) {
            throw new IOException("Exception does not exists");
        }

        descriptorFile.delete();

        DefaultLocalExtensionFile extensionFile = extension.getFile();

        extensionFile.getFile().delete();
    }
569136
function getFileTypeReg(type) {
    var map = [],
        ext = ""; // fis.config.get('project.fileType.' + type);
    if (type === 'text') {
        map = TEXT_FILE_EXTS;
    } else if (type === 'image') {
        map = IMAGE_FILE_EXTS;
    } else {
        xgulp.log.error('invalid file type [%s]', type);
    }
    if (ext && ext.length) {
        if (typeof ext === 'string') {
            ext = ext.split(/\s*,\s*/);
        }
        map = map.concat(ext);
    }
    map = map.join('|');
    return new RegExp('\\.(?:' + map + ')$', 'i');
}
442008
function getExtension(file) {
        var ret;
        if (file) {
            var fileTypes = file.split('.');
            var len = fileTypes.length;
            if (0 === len) {
                return ret;
            }
            ret = fileTypes[len - 1];
            return ret;
        }
    }
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));
	}
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;
	}
818023
@Nullable
  @ReturnsMutableCopy
  public ICommonsList <MimeTypeInfo> getAllInfosOfExtension (@Nullable final String sExtension)
  {
    // Extension may be empty!
    if (sExtension == null)
      return null;

    return m_aRWLock.readLocked ( () -> {
      ICommonsList <MimeTypeInfo> ret = m_aMapExt.get (sExtension);
      if (ret == null)
      {
        // Especially on Windows, sometimes file extensions like "JPG" can be
        // found. Therefore also test for the lowercase version of the
        // extension.
        ret = m_aMapExt.get (sExtension.toLowerCase (Locale.US));
      }
      // Create a copy if present
      return ret == null ? null : ret.getClone ();
    });
  }
1077169
public static void removeFileOpener(ServletContext servletContext, String ... extensions) {
		synchronized(fileOpenersLock) {
			@SuppressWarnings("unchecked")
			Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME);
			if(fileOpeners != null) {
				for(String extension : extensions) {
					fileOpeners.remove(extension);
				}
				if(fileOpeners.isEmpty()) {
					servletContext.removeAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME);
				}
			}
		}
	}
1259335
public String getFileType() {
        if (fileTypeOrName != null && fileTypeOrName.contains(".")) {
            return FileUtils.getExtension(fileTypeOrName);
        } else {
            return fileTypeOrName;
        }
    }
1189123
function _getExtension(file) {
        var ret;
        if (file) {
            var fileTypes = file.split(".");
            var len = fileTypes.length;
            if (0 === len) {
                return ret;
            }
            ret = fileTypes[len - 1];
            return ret;
        }
    }
759111
function (options, fileExtension) {
  var getOptionsKey = function (options, fileExtension) {
    for (var prop in options) {
      var _prop = prop.toLowerCase();

      if ((options[_prop].hasOwnProperty('allowed_file_extensions') && options[_prop].allowed_file_extensions.indexOf(fileExtension) > -1) || (!options[_prop].hasOwnProperty('allowed_file_extensions') && _prop === fileExtension)) {
        return prop;
      }
    }

    return null;
  };

  if (isNestedStructure(options)) {
    var optionsKey = getOptionsKey(options, fileExtension);
    return optionsKey !== null ? options[optionsKey]: {};
  }

  return options;
}
240393
public function getExtensionsByType()
  {
    $ext = array();

    foreach ($this->Config->get('file-extensions') as $key => $value)
    {
      $ext[$key] = $value['extensions'];
    }

    return $ext;
  }
865096
public ResourceFormatGenerator getGeneratorForFileExtension(final String extension) throws
        UnsupportedFormatException {
        for (final ResourceFormatGenerator generator : listGenerators()) {
            if (generator.getFileExtensions().contains(extension)) {
                return generator;
            }
        }
        throw new UnsupportedFormatException("No provider available to parse file extension: " + extension);
    }
761744
@Pure
	public static String[] extensions(URL filename) {
		if (filename == null) {
			return new String[0];
		}
		final String largeBasename = largeBasename(filename);
		final String[] parts = largeBasename.split(Pattern.quote(Character.toString(getFileExtensionCharacter())));
		if (parts.length <= 1) {
			return new String[0];
		}
		final String[] result = new String[parts.length - 1];
		for (int i = 0; i < result.length; ++i) {
			result[i] = decodeHTMLEntities(parts[i + 1]);
		}
		return result;
	}