any2Enum Function

Converts an anytype value to an enum value.


enum any2Enum(anytype object)

Parameter

Description

object

The value to convert.

An enum value.

The object parameter can be of most data types, but useful data is only obtained by using parameters of a str or int type.

static void any2EnumExample(Args _args)
{
    NoYes a;
    int i;
    str s;
    ;

    i = 0; // An int object that will be converted
    a = any2Enum(i);
    Global::info(strfmt("%1 is the output, from input of the %2 int object.", a, i));

    s = "1"; // A str object that will be converted
    a = any2Enum(myAny);
    Global::info(strfmt("%1 is the output, from input of the %2 str object.", a, s));

}
/**** Infolog display.
Message (01:05:30 pm)
No is the output, from input of the 0 int object.
Yes is the output, from input of the 1 str object.
****/

Community Additions

ADD
Show: