DOUBLE INTEGER into left-aligend STRING
It converts a value of the data type DINT into a value of the data type STRING in left-aligned decimal representation.
Input
Input data type
Output
Conversion result
Explanation
Function used |
String1 defined as |
Result |
---|---|---|
String1:= DINT_TO_STRING_LEFT_ALIGNED(-12345678) |
STRING[2] |
'-1' |
STRING[4] |
'-123' |
|
STRING[6] |
'-12345' |
|
STRING[8] |
'-1234567' |
|
STRING[10] |
'-12345678' |
|
STRING[12] |
'-12345678' |
|
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.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
diInputValue: DINT:=12345678;
sResult: STRING[11]:='';
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,DINT_TO_STRING_LEFT_ALIGNED!,,14,1,30,3,,?D?C);
B(B_VARIN,,diInputValue,12,1,14,3,);
B(B_VAROUT,,sResult,30,1,32,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
sResult:=DINT_TO_STRING_LEFT_ALIGNED(diInputValue);