



NOTICE

If the operand value for a type conversion operator is outside of the value range
of the target data type, then the result output depends on the processor type and
is therefore undefined. This is the case, for example, when a negative operand value
is converted from LREAL
to the target data type UINT
.
Information can be lost when converting from larger data types to smaller data types.
The operators convert a string (STRING
or WSTRING
) into the specified target data type and return a type-converted value.
A conversion with a meaningful result is only possible when the operand matches the target data type according to the IEC 61131-3 standard. This is the case if the value of the operand corresponds to a valid constant (literal) of the target data type.
Convertible strings contain:
-
Number with type prefix (example:
'16#FFFFFFFF'
) -
Number with grouping characters (example:
'2#1111_1111'
)Note: The international weight and measure grouping character (thin space) is not accepted. Only the underscore is accepted.
-
Floating-point number, also in exponential notation (example:
'9.876'
or'1.2E-34'
)Note: Floating-point numbers are not convertible. The comma is treated and truncated like a following character.
-
Time, time of day, and date specification with prefix and size (example:
'T#2h'
,'DT#2019-9-9-12:30:30.9'
) -
Infinite values (example:
'1.7E+400'
) -
Additional character after a number (example:
'2m'
or'3.14'
)These are truncated. Additional characters before a number are not permitted.
-
Spaces before (example:
'3.14'
)
-
Call syntax
-
Converting to a Boolean value
-
Examples