Converts a numeric value (decimal or hexadecimal) to a string.
The number in [Source Data] is converted to a string in the data format (decimal or hexadecimal) specified in [Source Data Format] and stored in [Destination Data].
TARGET = toString(EXPRESSION, 10, 0);
1 5
2 3/4
# | Description | ||||||||||||
1 | [Destination Data] Set the destination where you want to store the converted string. |
||||||||||||
2 | [Source Data Format]
Select one of the following formats: Block
Text
|
||||||||||||
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 number to convert is stored. |
(Example)
Var3=toString(Var1,10,0);
Variable in [Source Data] |
[Zero Suppress] | [Integer Digits] | Variable in [Destination Data] |
Comments | ||
Data Type and Value |
Format |
Maximum Number of Bytes | Converted string | |||
INT: 100 (0x64) | Decimal | Enable | - | 5 | 100 | - |
- | 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 | 4 | 5 | 0100 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
||
2 | 5 | 100 | Even if the value exceeds the [Integer Digits], sets the converted string. | |||
6 | 5 | (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.
|
|||
6 | Use [Variable length] | 000100 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
|||
Hex | Enable | - | 5 | 64 | - | |
- | 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 | 4 | 5 | 0064 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
||
6 | Use [Variable length] | 000064 |
"0" is added to align with the number of digits specified in
[Integer Digits].
|
|||
INT: -100 (0xFF9C) | Decimal | Enable | - | 5 | -100 |
"-" Minus sign is supported.
|
Disable | 4 | 5 | -0100 |
"-" Minus sign is supported.
|
||
Hex | Enable | - | 5 | FF9C | - | |
REAL: 100.00 | Decimal | Enable | - | 5 | 100 |
Only integer portion is converted.
|
Hex | Enable | - | 5 | 64 |
Only integer portion is converted.
|
|
REAL: 100.678 | Decimal | Enable | - | 5 | 100 |
Only integer portion is converted.
|
BOOL: true | - | - | - | 5 | True | - |
BOOL: false | - | - | - | 5 | False | - |
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 integer format to a string.
Date / Time Format: 8/19/2020 10:19:00 AM
Integer Format ([Source Data Format]: [Dec]): 1597799940
Integer Format ([Source Data Format]: [Hex]): 5F3C7E04