# int2oct

This function converts a single integer value to a single octetstring value. The resulting string is length octets long.

For the purposes of this conversion, an octetstring shall be interpreted as a positive base 16 integer value. The rightmost hexadecimal digit is least significant, the leftmost hexadecimal digit is the most significant. The number of hexadecimal digits provided shall be multiples of 2 since one octet is composed of two hexadecimal digits. The hexadecimal digits 0 .. F represent the decimal values 0 .. 15 respectively. If the conversion yields a value with fewer hexadecimal digits than specified in the length parameter, then the hexstring shall be padded on the left with zeros.

Related keyword:

- integer
- hexstring
- octetstring

### int2oct(in integer value, in integer length) return octetstring

Example 1:

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.