From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2002-03-21T03:42:49+09:00 Subject: Re: Why no String#bin? In article <1016615260.547741.18142.nullmailer@ev.netlab.jp>, Yukihiro Matsumoto wrote: >Hi, > >In message "Why no String#bin?" > on 02/03/20, Phil Tomson writes: > >|We've got: >|String#hex >|String#oct >| >|but there is no String#bin. >| >|It seems that we should have a String#bin for completeness. >| >|RCR? > >For this purpose, 1.7 String#to_i takes an optional radix argument, >for example: > > "11".to_i # => 11 > "11".to_i(2) # => 3 > "11".to_i(8) # => 9 > "11".to_i(10 # => 11 > "11".to_i(16) # => 17 > > matz. > This is very good. It's actually a lot better than having seperate hex, oct and bin methods on string. Phil