Thanks for your fast answer.

One last question, if you can help me.

How can I compare each characters in a string?

Drew Olson wrote:
> Johnathan Wagner wrote:
>> What I wanted to do is, for example, want to find all 8's and change it
>> to 5's.
>> I am stuck on how I can use the string and search each char's to find
>> the 8's and then change it. Also I would like to know if there is a for
>> loop or something to go through each array and store it into a new
>> string because there might be more than 3 lines. I have search through
>> documentations and trying to find examples but there doesn't seem to be
>> much help.
>> 
>> Any help, especially examples, would be appreciate. Thanks in advance.
> 
> The code below reads through your file, replaces 8's with 5's and then 
> writes out the lines to a new file:
> 
> File.open("newfile,txt","w") do |out|
>   File.open("myfile.txt").each do |line|
>     out << line.gsub("8","5")
>   end
> end


-- 
Posted via http://www.ruby-forum.com/.