From: Xavier Noria Date: 2007-08-14T23:47:01+09:00 Subject: Re: Convert a n binary number to /n On Aug 14, 2007, at 4:42 PM, Zangief Ief wrote: > If my number is 1111, I would like to had 0000. > If my number is 1001, I would like to had 0110. > If my number is 0011, I would like to had 1100. > > Of cours I know we can use XOR operator, but I would like to allow > Ruby > to do it more simply, just by using a function as simple as > possible. I > a sure this kind of function is yet setup in Ruby, but I don't know > what > is his name. A solution: irb(main):003:0> "0011".tr("01", "10") => "1100" -- fxn