Difference between revisions of "Core.Terms.ToInteger"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{DISPLAYTITLE:OTX '''ToInteger'''}}[[Category:Core]] | {{DISPLAYTITLE:OTX '''ToInteger'''}}[[Category:Core]] | ||
== Classification == | == Classification == | ||
− | {{ClassificationActivity | ToInteger | Converts an OTX term to a value of the Integer data type | [[Term]] | [[Core|OTX Core library]] | [[Conversion terms]] | | + | {{ClassificationActivity | ToInteger | Converts an OTX term to a value of the Integer data type | [[Term]] | [[Core|OTX Core library]] | [[Conversion terms]] | [[Core.DataTypes.ComplexDataType.OutOfBoundsException|OutOfBoundsException]]<br />[[Core.DataTypes.ComplexDataType.TypeMismatchException|TypeMismatchException]] | - }} |
== OTL Syntax == | == OTL Syntax == | ||
Line 23: | Line 23: | ||
*: Returns the integer value of the ByteField. For interpretation of the ByteField, little endian byte order and n-bit two's complement will be used, where n is the ByteField's size multiplied by 8 (in other words: the total number of bits in the original ByteField). | *: Returns the integer value of the ByteField. For interpretation of the ByteField, little endian byte order and n-bit two's complement will be used, where n is the ByteField's size multiplied by 8 (in other words: the total number of bits in the original ByteField). | ||
* '''String''' | * '''String''' | ||
− | *: Returns the integer value of the string. The string must conform to an [[Core.Terms.IntegerLiteral|IntegerLiteral]]. If not, | + | *: Returns the integer value of the string. The string must conform to an [[Core.Terms.IntegerLiteral|IntegerLiteral]]. If not, the [[Core.DataTypes.ComplexDataType.TypeMismatchException|TypeMismatchException]] is thrown. |
== Properties == | == Properties == |
Revision as of 12:18, 2 May 2019
Contents
Classification
Name | ToInteger |
Short Description | Converts an OTX term to a value of the Integer data type |
Class | Term |
Extension | OTX Core library |
Group | Conversion terms |
Exceptions | OutOfBoundsException TypeMismatchException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
IntegerTerm ToInteger(Term)
Description
This term will return the Integer counterpart of the argument term.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Integer | Returns the Integer counterpart of the argument term. |
Rules
- Boolean
- Returns 1 if true , otherwise 0
- Integer
- Returns a copy of the value
- Float
- Returns the integer part (the digits to the left of the decimal point will be truncated and will not be rounded).
- ByteField
- Returns the integer value of the ByteField. For interpretation of the ByteField, little endian byte order and n-bit two's complement will be used, where n is the ByteField's size multiplied by 8 (in other words: the total number of bits in the original ByteField).
- String
- Returns the integer value of the string. The string must conform to an IntegerLiteral. If not, the TypeMismatchException is thrown.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Term | - | Term | - | [1] | Represents the OTX term that will be converted to a new value of the Integer data type. See conversion rule descriptions above. |
OTL Examples
Integer Integer1;
Integer Integer2;
Integer Integer3;
Integer Integer4;
Integer Integer5;
Integer1 = ToInteger(true);
Integer2 = ToInteger(123456);
Integer3 = ToInteger(123.456);
Integer4 = ToInteger(&18 00 FF FF);
Integer5 = ToInteger("123456");