Titan



hexstring


The keyword hexstring denotes a basic string type whose distinguished values are the ordered sequences of  of hexadecimal digits, each corresponding to an ordered sequence of four bits.

Related keyword:


hexstring


Example 1:

const hexstring c_elch := 'C'H;

The constant called c_elch contains the hexadecimal string C.


Example 2:

const hexstring c_entiere := int2hex (64,3);

The constant c_entiere will contain the hexadecimal string 040 because the converted integer number (64 -> 40) must be coded on 3 hexadecimal digits and therefore padded with a leading zero.


Example 3:

const boolean c_undanbedes := ( c_entiere == c_elch );

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


Example 4:

const hexstring c_samman := c_entiere & c_elch;

The constant c_samman will contain the hexadecimal string 040C 


Example 5:

const hexstring c_lakomec := c_entiere[1];

The constant called c_lakomec will contain the hexadecimal string 4.


Example 6:

const hexstring c_tomt := ''H;

The constant called c_tomt will be an empty string.


Example 7a:

const octetstring c_kaprifol := hex2oct ('7AA'H);

The constant called c_kaprifol will contain the octet string 07AA. The resulting octet string contains 0 as leftmost hex digit followed by the same sequence of hex digits as in the hexadecimal string because the number of the hexadecimal digits is odd.


Example 7b:

const integer c_gondol := hex2int ('555'H);

The constant called c_gondol will have the integer value 1365. The result will be always positive.


Example 7c:

const bitstring c_perrongen := hex2bit ('A7'H);

The constant called c_perrongen will contain the bit string 10100111.


Example 7d:

const charstring c_snaella := hex2str ('BBC0530A0'H);

The constant called c_snaella will contain the string BBC0530A0 because the resulting character string has the same length as the hexadecimal string and contains only the characters '0' .. 'F'.


Example 7e:

const integer c_skynda := lengthof ('BBC0530A0'H);

The constant called c_skynda will have the value 9 corresponding to the number of octets in the string.


Example 8:

var hexstring c_mot ('010'H,'77'H,'A55CC'H );

The variable called c_mot may hold the hexadecimal strings 010, 77 and A55CC only.


Example 9

const hexstring c_koerhinta := '12345'H @> 2;

The constant called c_koerhinta will hold the value '45123'H (the left operand rotated by two hexadecimal digits). 


Example 10:

const hexstring c_wet := '12345'H >> 2; 

The constant called c_wet will hold the value '00123'H (the left operand shifted by two hexadecimal digits).



BNF definition of hexstring
BNF definition of hexstring value