From: 7stud -- Date: 2009-02-24T08:38:09+09:00 Subject: Re: what is best idiom to remove file extension bwv549 wrote: > What is the most concise, bulletproof idiom for removing the file > extension from a file? Maybe I've missed something obvious that > everyone else uses... > > Here's what I usually do: > > This is what I usually use if I want bulletproof: > filename.sub(/#{Regexp.escape(File.extname(filename))}$/, '') > How about: name = fname.chomp(File.extname(fname) ) -- Posted via http://www.ruby-forum.com/.