Conversion instructions
220
Part II IEC Instructions
INT_TO_STRING_
LEADING_ZEROS
INTEGER into STRING
Generates a result string in right-aligned decimal representation, filled with leading spaces up to
the predefined maximum number of characters.
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
Data type I/O Function
INT input input data type
STRING output conversion result
Function used String1
defined as
Result
STRING[1] '5'
STRING[2] '25'
STRING[3] '025'
STRING[4] '0025'
STRING[5] '00025'
STRING[6] '000025'
STRING[7] '0000025'
STRING[8] '00000025'
String1:=INT_TO_STRING(25)
and so on...
PLC types
Availability of INT_TO_STRING_LEADING_ZEROS (see page 1327)
When using the data type STRING with small PLCs like FP-e or FP0,
make sure that the length of the result string is equal to or greater than
the length of the source string.
For further information refer to the online help: Upgrade Problems with
Data Type STRING
Description
The function INT_TO_STRING_LEADING_ZEROS converts a value of the data type INT (positive
values) to a value of the data type STRING.
Example:
Data types
Explanation