Ronald Fischer wrote: > I have a string representing the name of a java file. I would > like to get a new string, where the extension .java has been > replaced by .class. [...] > This works fine, but I wonder whether there isn't a more > elegant way to do it. If you are *really* lazy: require 'rake' # NOTE: Not running rake, just using its library. java_file = "filename.java" class_file = java_file.ext("class") If you have a bunch of files that need this, you can do: require 'rake' java_files = FileList['src/**/*.java'] class_files = java_files.ext("class") If you need more extensive filename manipulation, check out the "pathmap" method (available on both FileLists and Strings when using rake). -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.