From: "Ara.T.Howard" Date: 2003-11-27T05:27:12+09:00 Subject: Re: turning a string into array of ASCII bytes On Thu, 27 Nov 2003, T. Onoma wrote: > Date: Thu, 27 Nov 2003 02:37:02 +0900 > From: T. Onoma > Newsgroups: comp.lang.ruby > Subject: Re: turning a string into array of ASCII bytes > > On Wednesday 26 November 2003 06:07 pm, Robert Klemme wrote: > > > > (i.e. so that s[0] and s[0,1] return the same thing, as is already true > > > of arrays). > > > > But you can be sure that then there will be another method (possibly > > String#at(index)) that is equivalent to String#[index] of today. > > or > > str[index].asc as the opposite of Integer#chr, perhaps? > > i thought we already had this but i can't seem to find it so guess we don't. > > -t0 you mean this? ~ > irb irb(main):001:0> 42.chr => "*" irb(main):002:0> 42.chr[0] => 42 irb(main):003:0> "*"[0] => 42 irb(main):004:0> "*"[0].chr => "*" -a -- ATTN: please update your address books with address below! =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | STP :: http://www.ngdc.noaa.gov/stp/ | NGDC :: http://www.ngdc.noaa.gov/ | NESDIS :: http://www.nesdis.noaa.gov/ | NOAA :: http://www.noaa.gov/ | US DOC :: http://www.commerce.gov/ | | The difference between art and science is that science is what we | understand well enough to explain to a computer. | Art is everything else. | -- Donald Knuth, "Discover" | | /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' ===============================================================================