REBOL Document

Debase - Function Summary


Converts a string from a different base representation to binary.


debase value


value - The string to convert (must be: any-string)


/base - Allow a selection of a different base for conversion

base-value - The base to convert from: 64, 16, or 2


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
    "a string of text"

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"


dehex - Converts URL-style hex encoded (%xx) strings.
enbase - Converts a string to a different base representation.

<Back | Index | Next>

Copyright 2004 REBOL Technologies