From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9v?= =?ISO-8859-1?Q?ue?=) Date: 2007-03-25T17:25:12+09:00 Subject: Re: adding anotehr each method to String Chris Shea wrote: > > What you need is "yield". > > This does what you need: > > class String > def each_char > 0.upto(self.length - 1) do |x| > yield self[x,1] > end > end > end > > yield passes a value to a block. Ok, fine thanks a lot ! does the method : String.to_a doing : s="a string" sa=s.to_a #=> ['a',' ','s','t','r','i','n','g'] exists allready ? generally speaking how to list-out, for a given class all the methods ? in order to avoid collapsing them. -- It's easy to play any musical instrument: all you have to do is touch the right key at the right time and the instrument will play itself. -- J.S. Bach