Hi --
On Mon, 5 Aug 2002, Mike Hall wrote:
> David Alan Black wrote:
>
> > /[^.]*$/.match(file)[0]
>
> Now wouldn't all this be much simpler if we had a method
> along the lines of 'basename', which would pull off the
> extension (or suffix) for us? We already have File::basename
> and File::dirname, so why not a File::last-part-of-the-name-name?
>
> Or what about a 'File::parts' which returns an array of:
> directory (or nil), root name (or nil), suffix(es) (or nil).
> Would that be more Ruby-esqe?
Heavens -- object-oriented regular expressions are Ruby-esque enough
for you? :-)
Of course, writing add-on libraries is very Ruby-esque too, so have
at it!
David
--
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web: http://pirate.shu.edu/~blackdav