# Convert Float to String

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].

##### Block

##### Text

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] ##### Block Select the check box to suppress displaying zeros at the front of values. Clear 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.
(Example) [Source Data]: 25, [Integer Digits]: 4
When check box is selected (enabled): | 25
When check box is cleared (disabled): | 0025
##### Text Set '0' to suppress displaying zeros at the front of values. Set 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.
(Example) [Source Data]: 25
[Integer Digits]: 0 | 25
[Integer Digits]: 4 | 0025
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)

##### Block

##### Text

Var3=floatToString(Var2,0,1);

## Operation Example

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.

Note: 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
- TIME_OF_DAY
- DATE_AND_TIME

### (Example) DATE_AND_TIME Variable

Date / Time Format: 8/19/2020 10:19:00 AM

Real Format ([Source Float Decimal Places]: 1): 1597799940.0