From: Ronald Fischer Date: 2007-08-16T16:57:57+09:00 Subject: Re: Exchanging the extension in a filename > * Ronald Fischer (12:05) schrieb: > > > filename.sub(/java$/,'class') > > I'd match the point too, not everything that ends with "java" is java > source file: filename.sub(/\.java$/, '.class') In general, yes, but in my case I *know* that the file ends in .java anyway, so matching the dot is not so important. > > This works fine, but I wonder whether there isn't a more > > elegant way to do it. > > What is unelegant about that? Maybe I did too much shell programming before ;-) On shell level, I would do a $(dirname $FILENAME)/($basename $FILENAME java)class so I was thinking whether I might have overlooked some useful method in the FilePath or File class which would be helpful here. Thanks for the advice... Ronald