REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: debase

debase  value  /base  base-value

Decodes binary-coded string (BASE-64 default) to binary value.


value [binary! string!] - The string to decode


/base - Binary base to use

base-value [integer!] - The base to convert from: 64, 16, or 2

See also:

enbase   dehex  


Converts from an encoded string to the binary value. Primarily used for BASE-64 decoding.

The /base refinement allows selection of number base as 64, 16, 2. Default is base64.

probe debase "MTIzNA=="
probe debase/base "12AB C456" 16
enbased: probe enbase "a string of text"
probe string? enbased         ; enbased value is a string
debased: probe debase enbased ; converts to binary value

probe to-string debased       ; converts back to original string

If the input value cannot be decoded (such as when missing the proper number of characters), a none is returned.

probe debase "100"

probe debase "1001"

  TOC < Back Next > - WIP Wiki Feedback Admin