IB Statements/base256

From CometWiki

Jump to: navigation, search

BASE256 function

Syntax: BASE256(string-argument,numeric-error-argument)

Discussion: The BASE256 function de-encodes the string-argument (a Base 64 string) into its original value. To encode a string using the Base 64 scheme, use the BASE64 function.

For more information about Base 64 encoding, please see RFC 1421.


Note

For every 4 characters in the string-argument, the BASE256 function returns 3 characters. The numeric-error-argument is a numeric variable with a length and precision of at least 1.0. If the BASE256 function successfully de-encodes the string-argument, the numeric-error-argument is set to 0. If the conversion is unsuccessful (e.g., if the string-argument contains an invalid Base 64 character), it is set to 1.

History: This function was added in Build 290.

Example: LENGTH 30 & LOCAL B$

LENGTH 40 & LOCAL A$

LENGTH 1.0 & LOCAL ERR

.

B$ = BASE256(A$,ERR)  ! De-encode A$

IF ERR = 1 THEN

PRINT (0) "ERROR IN BASE256 CONVERSION."

ENDIF

Personal tools