From: Tim Bates Date: 2002-11-26T12:10:41+09:00 Subject: Re: Things That Newcomers to Ruby Should Know (11/24/02) On Tue, 26 Nov 2002 01:33 pm, Austin Ziegler wrote: > Everything else is done with native Ruby loops -- I find that I just > *don't care* about incrementing indexes, because Ruby does the right > thing for me. This relates to my email a few minutes earlier about collect_with_index, but how would you do this without incrementing an index, given the current lack of existance of a collect_with_index method? To take a string, split it into paragraphs, turn each of them into an HTML

and number them: i = 0; string.split("\n").collect{ |para| '

' + (i += 1).to_s + " - " + para }.join("\n") Tim Bates -- tim@bates.id.au