UDINT_TO_STRING_LEADING_ZEROS

Unsigned DOUBLE INTEGER into STRING

This function converts a value of the data type UDINT (positive value) into a value of the data type STRING. It generates a result string in decimal representation that is right aligned. It is filled with leading zeros up to the maximum number of characters defined for the string.

Parameters

Input

Unnamed input (UDINT)

Input data type

Output

Unnamed output (STRING)

Conversion result

Example

Explanation:

Function used

String1 defined as

Result

String1:=UDINT_TO_STRING(12345678)

STRING[2]

'78'

STRING[4]

'5678'

STRING[6]

'345678'

STRING[8]

'12345678'

STRING[10]

'0012345678'

STRING[12]

'000012345678'

and so on...

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.

Related topics:

Modified on: 2019-01-24Feedback on this pagePanasonic hotline