Converts a real number to a string.
The real number in [Source Data], up to the number of decimal places specified in [Source Float Decimal Places], is converted to a string and stored in [Destination Data].
TARGET = floatToString (EXPRESSION, 0, 1);
1 5
3/4 2
# | Description | ||||||||||||
1 | [Destination Data]
Set the destination where you want to store the converted string. |
||||||||||||
2 | [Source Float Decimal
Places]
Specify the number of decimal places to convert. Setting Value Range: 0 - 16 |
||||||||||||
3 | [Zero Suppress] BlockClear the check box to specify the number of [Integer Digits], and to add zeros at the front of values to align with the number of digits.
TextSet a numeric value between '1' and '20' to specify the number of [Integer Digits], and to add zeros at the front of values to align with the number of digits.
|
||||||||||||
4 | [Integer Digits]
Specify the number of digits in the string to convert. Setting Value Range: 1 - 20 When [Script Mode] is [Block], set this value when the [Zero Suppress] check box is cleared. |
||||||||||||
5 | [Source Data]
Set the source data where the real number to convert is stored. |
(Example)
Var3=floatToString(Var2,0,1);
Variable in [Source Data] |
[Source Float Decimal Places] | [Zero Suppress] | [Integer Digits] | Variable in [Destination Data] |
Comments | |
Data Type and Value |
Maximum Number of Bytes | Converted string | ||||
REAL: 1.2345 | 2 | Enable | - | 5 | 1.23 | - |
- | 1 | (none) |
A string is not stored because the converted string has exceeded the maximum
number of bytes that can be stored. It is judged as fail in the "Operation
Result" Operation.
|
|||
Disable | 3 | 6 | 001.23 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
||
4 | 6 | (none) |
A string is not stored because the converted string has exceeded the maximum
number of bytes that can be stored. It is judged as fail in the "Operation
Result" Operation.
|
|||
4 | Use [Variable length] | 0001.23 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
|||
0 | Enable | - | 5 | 1 | - | |
REAL: 1.2367 | 2 | Enable | - | 5 | 1.24 | Value is rounded off. |
REAL: -1.2345 | 2 | Enable | - | 5 | -1.23 |
"-" Minus sign is supported.
|
Disable | 2 | 6 | -01.23 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
||
3 | 6 | (none) |
A string is not stored because the converted string has exceeded the maximum
number of bytes that can be stored. It is judged as fail in the "Operation
Result" Operation.
|
|||
0 | Enable | - | 5 | -1 | - | |
INT: 10 | 2 | Enable | - | 5 | 10.00 |
Only integer portion is converted.
|
Even though you set one of the following date type values as the [Source Data], the value is not converted in date/time format to a string. The value is converted in real number format to a string.
Date / Time Format: 8/19/2020 10:19:00 AM
Real Format ([Source Float Decimal Places]: 1): 1597799940.0