Extracting Filename (without Extension) In Ruby
Join the DZone community and get the full member experience.
Join For Free
Shortest, rock-solid idiom for removing the extension, without
removing the preceding path:
fname.chomp(File.extname(fname))
Best idiom if you are removing the path also:
File.basename(fname, '.*')
Opinions expressed by DZone contributors are their own.
Comments