@param [String, File] filename   The full filename, or path

 @return [String] The file extension
168214
def file_extension(filename)
      ext = File.extname(filename).gsub('.','').downcase if filename
      # for remote files which has asset id after extension
      ext.split('?')[0]
    end
1162993
function (fileName) {
            if (!file.exists(fileName)) {
                try {
                    //Try to find the path of the file thanks to node's require resolving.
                    fileName = nodeRequire.resolve(fileName);
                } catch(e) {}
            }
            return frontSlash(path.normalize(frontSlash(fs.realpathSync(fileName))));
        }
1189806
def from_filename(file_name):
    
    base, extension = os.path.splitext(file_name)
    if extension in COMPRESS_EXT:
        # Compressed file
        extension = os.path.splitext(base)[1]
    return from_extension(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);
    }
535563
@Pure
	public static String[] extensions(File 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];
		System.arraycopy(parts, 1, result, 0, result.length);
		return result;
	}
992516
def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
      fn = file_name + ".rake"
      return false if loaded.include?(fn)
      paths.each do |path|
        full_path = File.join(path, fn)
        if File.exist?(full_path)
          Rake.load_rakefile(full_path)
          loaded << fn
          return true
        end
      end
      fail LoadError, "Can't find #{file_name}"
    end
633591
def extension attachment, style_name
      ((style = attachment.styles[style_name]) && style[:format]) ||
        File.extname(attachment.original_filename).gsub(/^\.+/, "")
    end
478873
static function filenameWithoutExtension($filename) {
		$filename=self::filename($filename);
		if (preg_match('~(.*)\.(\w{1,10})$~',$filename,$parts)) {
			return $parts[1];
		}
		return $filename;
	}
1302233
def split_path(path)
      path = path.to_s
      extension = File.extname(path)[1..-1] || ""
      path_without_extension = path.sub(/\.#{Regexp.escape(extension)}\Z/, "")
      [extension, path_without_extension]
    end
1356383
def parseFilename(filename):
    
    # Parse out any extension specified in filename
    _indx = filename.find('[')
    if _indx > 0:
        # Read extension name provided
        _fname = filename[:_indx]
        extn = filename[_indx+1:-1]

        # An extension was provided, so parse it out...
        if repr(extn).find(',') > 1:
            _extns = extn.split(',')
            # Two values given for extension:
            #    for example, 'sci,1' or 'dq,1'
            _extn = [_extns[0],int(_extns[1])]
        elif repr(extn).find('/') > 1:
            # We are working with GEIS group syntax
            _indx = str(extn[:extn.find('/')])
            _extn = [int(_indx)]
        elif isinstance(extn, str):
            # Only one extension value specified...
            if extn.isdigit():
                # We only have an extension number specified as a string...
                _nextn = int(extn)
            else:
                # We only have EXTNAME specified...
                _nextn = extn
            _extn = [_nextn]
        else:
            # Only integer extension number given, or default of 0 is used.
            _extn = [int(extn)]

    else:
        _fname = filename
        _extn = None
    return _fname,_extn
43455
function(filename){
    // resolve by symlink if possible
    for (var from in this.symlinks)
      if (filename.indexOf(from) === 0 && (filename === from || filename[from.length] === '/'))
        return this.symlinks[from] + filename.substr(from.length);

    return path.resolve(this.fsBaseURI, filename.replace(/^[\\\/]/, ''));
  }
643653
public static String getExtension(String fileName) {
        if (fileName.contains(".")) {
            return fileName.substring(fileName.lastIndexOf(".") + 1);
        }
        return "png";
    }
1226393
def filename
      return unless original_filename

      filename = if model.respond_to?("#{mounted_as}_filename")
                   model.send("#{mounted_as}_filename")
                 else
                   model.title.parameterize
                 end

      # Safe-guard against customized filename methods or parameterize returning an empty string
      return original_filename if filename.blank?

      "#{filename}.#{file.extension}"
    end
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;
			}
		}		
	}
23812
public static String getExtension(String fileName) {
        if (fileName == null)
            return null;

        String[] tokens = split(fileName);
        if (tokens.length >= 2)
            return tokens[tokens.length - 1];

        return null;
    }
1358342
def extension_from_filename(filename):
    
    # Parse out any extension specified in filename
    _indx1 = filename.find('[')
    _indx2 = filename.find(']')
    if _indx1 > 0:
        # check for closing square bracket:
        if _indx2 < _indx1:
            raise RuntimeError("Incorrect extension specification in file " \
                                "name \'%s\'." % filename)
        # Read extension name provided
        _fname = filename[:_indx1]
        _extn = filename[_indx1+1:_indx2].strip()
    else:
        _fname = filename
        _extn = None

    return _fname, _extn
1077868
public static String getExtension(String filename)
   {
      int index = filename.lastIndexOf('.');

      if (index >= 0)
      {
         return filename.substring(index + 1);
      }

      return "";
   }