From: Tom Sawyer Date: 2002-07-09T05:52:08+09:00 Subject: Re: is there a better string.each? if/when $/ accepts regexps, what about '' as a seperator meaning each character instead of multiple successive \n's? to me this seems a dubious equality --an exception caused by the lack of $/ accepting regexps. if so, each_char (each_chr?) would technically be unneccessary, but i wouldn't mind it being there too, along side each_byte and each_line. also i don't know if we need two seperate methods (e.g. #each_line vs. #lines) for iterating over a block versus returning an array. the same method can be used for both, depending on whether a block is given or not. right? ~transami On Mon, 2002-07-08 at 13:52, Austin Ziegler wrote: > On Tue, 9 Jul 2002 04:41:04 +0900, Tobias Reif wrote: > > Tom Sawyer wrote: > >> but that left us with no equivalent to the fictional #each_chr, > > so what about a simple RCR, asking for > > String#chars > > so that we can do > > 'foo'.chars #> ["f","o","o"] > > and > > 'foo'.chars.each do |char| > > perhaps plus String#each_char? > > I think that this could work. I also think that an RCR should be > done so that $/ (and the argument to String#each) can be a regexp. > > -austin > -- Austin Ziegler, austin@halostatue.ca on 2002.07.08 at 15.51.04 > > > -- ~transami "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin