NUM_TO_STRING
Inputs
IN : ANY Input number.
WIDTH : DINT Wished length for the output string (see remarks)
DIGITS : DINT Number of digits after decimal point
Outputs
Q : STRING Value converted to string.
Remarks
This function converts any numerical value to a string. Unlike the ANY_TO_STRING function, it allows you to specify a wished length and a number of digits after the decimal points.
If WIDTH is 0, the string is formatted with the necessary length.
If WIDTH is greater than 0, the string is completed with heading blank characters in order to match the value of WIDTH.
If WIDTH is greater than 0, the string is completed with trailing blank characters in order to match the absolute value of WIDTH.
If DIGITS is 0 then neither decimal part nor point are added.
If DIGITS is greater than 0, the corresponding number of decimal digits are added. '0' digits are added if necessary
If the value is too long for the specified width, then the string is filled with '*' characters.
Examples
Q := NUM_TO_STRING (123.4, 8, 2); (* Q is ' 123.40' *)
Q := NUM_TO_STRING (123.4, -8, 2); (* Q is '123.40 ' *)
Q := NUM_TO_STRING (1.333333, 0, 2); (* Q is '1.33' *)
Q := NUM_TO_STRING (1234, 3, 0); (* Q is '***' *)