Skip to main content
Version: 7.0

Type conversion operator

The type conversion operator creates a property that performs type conversion.

Syntax​

className(expr)

Description​

The operator creates a property whose value is the value of expr converted to the built-in class className. Which conversions are meaningful, and when the result is NULL, is determined by the type conversion abstraction.

An object of a user class is converted to numeric and string classes (the result is the internal identifier of the object) and to the logical class (the result is TRUE); a value narrowed to a user class is returned by the AS operator.

Parameters​

  • className

    The target built-in class that the value is converted into. Any built-in class may be specified, including parameterized ones written with their parameters (for example, STRING[15], BPSTRING[10], or NUMERIC[10,2]).

  • expr

    The expression whose value is converted.

Examples​

itemCount = DATA INTEGER (Store);
itemCountToString(s) = BPSTRING[10](itemCount(s));

barcode = DATA STRING[15] (Item);
longBarcode(Item i) = LONG(barcode(i));