From: Ronald Fischer Date: 2007-08-16T16:54:10+09:00 Subject: Re: Exchanging the extension in a filename > > filename="abc/x.java" > > filename.sub(/java$/,'class') > > > > This works fine, but I wonder whether there isn't a more > > elegant way to do it. > > > > Ronald > > -- > > Ronald Fischer > > Phone: +49-89-452133-162 > > filename = "abc/x.java" > ==>"abc/x.java" > filename[ /java$/ ] = "class" > ==>"class" > filename > ==>"abc/x.class" Thanks - this is a nice alternative (for the case I actually want to modify filename). Of course it assumes that I know that the file ends in .java (but this is true in my case anyway). Ronald