Nobuyoshi Nakada
10/14/2006 1:55:00 AM
Hi,
At Sat, 14 Oct 2006 06:10:23 +0900,
Snoopy Dog wrote in [ruby-talk:219613]:
> if File.file? path
> puts path + ' is a file'
> oldname = path
newname = path.sub('longfilename - 0', '0')
> puts newname + ' Is the newfile'
> puts "\n\nCheck About to RENAME file"
> File.rename(oldname, newname)
> puts 'Renamed ' + oldname + ' to ' + newname + "\n\n\n"
> end
Assigning path to newpath doesn't create a new string, but
makes the latter to share the same string with the former and
oldname.
--
Nobu Nakada