syntax
- uint32(a)
- NumericValueu
definition
uint32(a) results in a 32 bits unsigned integer item casted from item a. The function results in:
- for integer data items, the integer value is interpreted as uint32 value, if the value exceeds the maximum value for uint32 value types, the result is null;
- for float32/64 data items the value before the decimal point is used (so 1.9 will be rounded off to 1 and 2.0 to 2). If the value exceeds the maximum value for uint32 value types, the result is null;
- for boolean data items, 1 for True values and 0 for False values;
- for string data items, if the value starts with an allowed numeric value for the value type, this value is casted to a uint32 value type. Other characters found after the numeric values are neglected. If the string does not start with an allowed numeric value for the value type, the result value is null.
- for units, a 32 bits unsigned integer variant of the casted unit.
description
uint32 is used as a function to cast units or data items to the value type with the similar name. The allowed range of values for the uint32 value type can be found in the value types table.
The suffix u can be used to denote a numerical value to a uint32 value type (altough this is not necessary as 1 is by default interpreted as a uint32 value). Examples 1 and 2 are synonyms.
applies to
Data item or unit with Numeric, uint2, uint4, bool or string value type
since version
5.15, u suffix since 7.105
example
1. parameter<uint32> uint32Numeric1 := uint32(1);
2. parameter<uint32> uint32Numeric1 := 1u;
3. attribute<uint32> uint32A (ADomain) := uint32(A);
4. attribute<uint32> uint32B (ADomain) := uint32(B);
A(float32) | B(string) | uint32A | uint32B | |
0 | 'Hello' | 0 | null | |
1 | 'Test' | 1 | null | |
1000000 | null | 1000000 | null | |
-2.5 | 'Two words' | null | null | |
99.9 | '88a' | 99 | 88 |