encode64

Base64-encodes a string.

Merely wraps Base64.encode and std.string.representation into one function that will work with strings.

@safe pure nothrow
string
encode64
(
const string line
)

Parameters

line string

String line to encode.

Return Value

Type: string

An encoded Base64 string.

Examples

{
    immutable password = "harbl snarbl 12345";
    immutable encoded = encode64(password);
    assert((encoded == "aGFyYmwgc25hcmJsIDEyMzQ1"), encoded);
}
{
    immutable string password;
    immutable encoded = encode64(password);
    assert(!encoded.length, encoded);
}

See Also