From: gabriele renzi Date: 2007-09-23T02:50:04+09:00 Subject: Re: How would you write it vs Smalltalk On Sun, 23 Sep 2007 02:37:28 +0900, SpringFlowers AutumnMoon wrote: > I just wonder how would you write it? There is no each_char it seems, > unless with ActiveSupport. running away but a quick idea: you could use Integer#chr to get a char (well, a one-byte-string) from an integer. And, since you're dwelling with bytes anyway, you could just do a test like if c =~ ?a..?z (?a being the literal to get the integer value of a character) So something like: gets.downcase.each_byte {|b| h[c.chr] += 1 if c =~ ?a..?z} -- goto 10: http://www.goto10.it blog it: http://riffraff.blogsome.com blog en: http://www.riffraff.info