Titan



octetstring


The keyword octetstring denotes a basic string type whose distinguished values are the ordered sequences of  2n hexadecimal digits where n is a non-negative integer.

            TITAN specific extension to the standard:

    • oct2char converts an octet string to a character string.

Related keywords:


octetstring


Example 1:

const octetstring c_ok := 'A5'O;

The constant defined is called c_ok and contains the octet string A5.


Example 2:

const octetstring c_entier := int2oct (266,2);

The constant c_entier will contain the octet string 010A because the converted integer number (127 -> 10A) must be coded on 2 octets and therefore padded with a leading zero.


Example 3:

const boolean c_niet := ( c_entier == c_ok );

The constant c_niet will have the value false, because two octet strings are not equal. The parentheses are optional.


Example 4:

const octetstring c_clotre := c_entier & c_ok;

The constant c_clotre will contain the octet string 010AA5 


Example 5:

const octetstring c_samotny := c_entier[1];

The constant called c_samotny will contain the octet string 0A.


Example 6:

const octetstring c_nil := ''O;

The constant called c_nil will be an empty string.


Example 7a:

const hexstring c_kungsen := oct2hex ('AA'O);

The constant called c_kungsen will have the hexadecimal value AA. Although both values on the screen may look the same (AA), they have different types (octet string respective character string).


Example 7b:

const integer c_prednost := oct2int ('55'O);

The constant called c_prednost will have the integer value 85. The result will be always positive.


Example 7c:

const bitstring c_kvar := oct2bit ('44'O);

The constant called c_kvar will contain the bit string 01000100.


Example 7d:

const charstring c_lettres := oct2str ('80FBBC0530A0'O);

The constant called c_lettres will contain the string 80FBBC0530A0 because the resulting character string has the double length as the octet string and contains only the characters '0' .. 'F'.


Example 7e:

const integer c_laenge := lengthof ('80FBBC0530A0'O);

The constant called c_laenge will have the value 6 corresponding to the number of octets in the string .


Example 7f:

const charstring c_specific := oct2char (’4469707379’O);

The constant called c_specific will contain the string "Dipsy" because the resulting character string will have the same length as the incoming octet string. The octets are interpreted as ISO/IEC 646 [8] codes (according to the IRV) and the resulting characters are stored in the returned string. Octet values higher than 7F cause an error.


Example 8:

var octetstring c_hinder ('1010'O,'77'O,'AA55CC'O );

The variable called c_hinder may hold the octet strings 1010, 77 and AA55CC only.


Example 9

const octetstring c_go_round := '1122334455'O <@ (1+2);

The constant called c_go_round will hold the value '4455112233'O (the left operand rotated by three octets).


Example 10:

const octetstring c_slip := '1122334455'O << (1+1);

The constant called c_slip will hold the value '3344550000'O (the left operand shifted by two octets) .



BNF definition of octetstring
BNF definition of octetstring value