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

REBOL 3 Functions: enbase

enbase  value  /base  base-value

Encodes a string into a binary-coded string (BASE-64 default).

Arguments:

value [binary! string!] - If string, will be UTF8 encoded

Refinements:

/base - Binary base to use

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

See also:

debase   dehex  

Description

Converts from a string or binary into an encode string value. Primarily used for BASE-64 encoding.

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

print enbase "Here is a string."
SGVyZSBpcyBhIHN0cmluZy4=
print enbase/base #{12abcd45} 16
12ABCD45

The debase function is used to convert the binary back again. For example:

bin: enbase "This is a string"
print debase bin
#{54686973206973206120737472696E67}


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin