encode

Encodes data and returns as an ASCII base64 string

  1. mstring encode(ubyte[] data, mstring buff, bool pad)
  2. mstring encode(ubyte[] data, bool pad)
    encode
    (
    in ubyte[] data
    ,
    bool pad = true
    )

Parameters

table

The encode table to use, either defaultEncodeTable (the default) or urlSafeEncodeTable, or one's own encode table.

data ubyte[]

what is to be encoded

pad bool

Whether or not to pad the output - default to true

Examples

mstring myEncodedString = encode(cast(ubyte[])"Hello, how are you today?");
Stdout(myEncodedString).newline; // SGVsbG8sIGhvdyBhcmUgeW91IHRvZGF5Pw==

Meta