IntToString Method (RUNTIME)


10.3A

 

The IntToString method converts an integer value into a decimal or hexadecimal character format that is returned in a Character String Variable. This method uses the following format:

 

[label]

{object}.IntToString

[GIVING {return}] USING [*Integer=]{integer}[:

 

 

[*Format=]{format}][:

 

 

[*Options=]{options}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A RUNTIME object.

return

Optional. A Character String Variable that returns characters formatted as identified by the {format} type.

integer

Required. A Numeric Variable or decimal number that specifies a value that identifies the character string format to be returned.

format
Optional. A Numeric Variable or decimal number that specifies a value that identifies the character string format to be returned.

options

Optional. A Numeric Variable or decimal number that is a bitmask value that defines the integer value range ( whole value, low order byte, or low order word ).

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is set TRUE if the {return} Character String variable is too small to receive the directory data without being truncated.

  2. The ZERO and OVER flags are always cleared.

  3. The {format} values are described as follows:

  4.  

    Value

    Description

    0

    The integer value is converted into decimal characters and returned in a 'ddddd' format.

    1

    The integer value is converted into hexadecimal characters and returned in a '0xXXXXXXXX' format.

    n < 0

    The return string is NULL.

    n > 1

    The return string is NULL.

     

  5. The {options} bit mask values are described as follows:

 

Value

Description

0

No change from previous behaviors when {options} not used.

1

Return as unsigned, no leading zeros.

2

Return the bottom byte as unsigned, 2 digits for hex.

4

Return the bottom word as unsigned, 4 digits for hex

 

Examples:

 

R RUNTIME

Int1 INTEGER 4,"123456"

.

. S$CMDLIN returns a character string as "123456".

.

          R.IntToString GIVING S$CMDLIN USING Int1

.

. S$CMDLIN returns a character string as "0x0001E240"

               .

          R.IntToString GIVING S$CMDLIN USING *INTEGER=Int1,*FORMAT=1

 

 

See Also: RUNTIME, RUNTIME Methods, Method Syntax

 



PL/B Language Reference IntParse Method (RUNTIME) JqmOptions Method (RUNTIME)