The OpenD Programming Language

text2ion

Convert an Ion Text value to a Ion data.

  1. immutable(ubyte)[] text2ion(const(char)[] text)
    @trusted pure
    immutable(ubyte)[]
    text2ion
    (
    scope const(char)[] text
    )
  2. void text2ion(const(char)[] text, Appender appender)

Parameters

text const(char)[]

The text to convert

Return Value

Type: immutable(ubyte)[]

An array containing the Ion Text value as an Ion data.

Examples

static immutable ubyte[] data = [0xe0, 0x01, 0x00, 0xea, 0xe9, 0x81, 0x83, 0xd6, 0x87, 0xb4, 0x81, 0x61, 0x81, 0x62, 0xd6, 0x8a, 0x21, 0x01, 0x8b, 0x21, 0x02];
assert(`{"a":1,"b":2}`.text2ion == data);
static assert(`{"a":1,"b":2}`.text2ion == data);
enum s = `{a:2.232323e2, b:2.1,}`.text2ion;

Meta