Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Converting numbers to binary form

From: mh983:attbi at: 10-Sep-2002 18:39

Here's a script I copied from pg 232 of REBOL for Dummies (thanks Ralph Roberts): The commented print is the original which only prints the lowest 8 bits, so I just added "print bin" to print the whole thing: print-binary: func [a [integer! char!]][ bin: enbase/base (load rejoin [ "#{" to-hex either char? a [to-integer a][a] "}"]) 2 ; print find/last/any bin "????????" ; last 8 bits print bin ] sample output:
>> print-binary
23456110 00000001011001011110100101101110