The OpenD Programming Language

representation

Returns the representation of a string, which has the same type as the string except the character type is replaced by ubyte, ushort, or uint depending on the character width.

@safe pure nothrow @nogc
representation
(
Char
)
(
Char[] s
)
if ()

Parameters

s Char[]

The string to return the representation of.

Return Value

Type: auto

The representation of the passed string.

Examples

string s = "hello";
static assert(is(typeof(representation(s)) == immutable(ubyte)[]));
assert(representation(s) is cast(immutable(ubyte)[]) s);
assert(representation(s) == [0x68, 0x65, 0x6c, 0x6c, 0x6f]);

Meta