Difference between revisions of "Core.Terms.ToInteger"

From emotive
Jump to navigation Jump to search
 
Line 33: Line 33:
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 +
/// Local Declarations
 +
 
Integer Integer1;
 
Integer Integer1;
 
Integer Integer2;
 
Integer Integer2;
Line 38: Line 40:
 
Integer Integer4;
 
Integer Integer4;
 
Integer Integer5;
 
Integer Integer5;
 +
 +
/// Flow
  
 
Integer1 = ToInteger(true);
 
Integer1 = ToInteger(true);

Latest revision as of 04:11, 7 May 2019

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.

Icons Note.png 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

/// Local Declarations

Integer Integer1;
Integer Integer2;
Integer Integer3;
Integer Integer4;
Integer Integer5;

/// Flow

Integer1 = ToInteger(true);
Integer2 = ToInteger(123456);
Integer3 = ToInteger(123.456);
Integer4 = ToInteger(&18 00 FF FF);
Integer5 = ToInteger("123456");

See also

ToBoolean
ToFloat
ToByteField
ToString