Extracts a string from the left or right edge.
TARGET = substringFromLeft(INPUT, COUNT);
1 2
4 3
# | Description |
1 | [Destination Data]
Set the destination where you want to store the extracted string. |
2 | Direction to extract the string
Block
Text
Select the direction used for extracting the string. (Example) String: "ABCDE", [Number of characters]: 3Red characters are extracted.
|
3 | [Number of characters]
Set a block that specifies the number of characters to extract. The value must be greater than or equal to 1, and less than or equal to the number of characters that can be extracted. Double-byte characters are counted as a single character. |
4 | [Source Data]
Set the source data where the string to extract is stored. |
(Example)
Var4 = substringFromLeft(Var3,Var1);
Variable in [Source Data] |
[Way to extract] | [Number of characters] |
Variable in [Destination Data] |
Comments | |
Target string |
Maximum Number of Bytes | Extracted string to store | |||
ABCDE | From Left | 3 | 5 | ABC | - |
0 | 5 | (none) |
A string is not stored because the [Number
of characters] is less than 1. It is judged as fail in
the "Operation Result" Operation.
|
||
3.6 | 5 | ABC |
Values to the right of the decimal point in [Number
of characters] are dropped.
|
||
From Right | 3 | 5 | CDE | - | |
-1 | 5 | (none) |
A string is not stored because the [Number
of characters] is less than 1. It is judged as fail in
the "Operation Result" Operation.
|
||
3.7 | 5 | CDE |
Values to the right of the decimal point in [Number
of characters] are dropped.
|
||
AB | From Left | 3 | 5 | (none) |
A string is not stored because the [Number
of characters] exceeds the number of retrievable characters.
It is judged as fail in the "Operation Result" Operation.
|
From Right | 3 | 5 | (none) |
A string is not stored because the [Number
of characters] exceeds the number of retrievable characters.
It is judged as fail in the "Operation Result" Operation.
|
|
ABCD(0x00)C | From Right | 3 | 5 | BCD |
If there is a NULL (0x00), the string is terminated there.
|
AB(0x00)CD | From Left | 3 | 5 | (none) |
A string is not stored. If there is a NULL (0x00), the string is terminated
there. As a result, the [Number of characters] exceeds the number of retrievable
characters. It is judged as fail in the "Operation Result" Operation.
|
AB(0x00)CDEF | From Right | 3 | 5 | (none) |
A string is not stored. If there is a NULL (0x00), the string is terminated
there. As a result, the [Number of characters] exceeds the number of retrievable
characters. It is judged as fail in the "Operation Result" Operation.
|
ABCDEFGH | From Left | 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.
|
From Right | 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.
|
|
AあB | From Left |
3 | 5 | AあB |
String is stored based on the [Number
of characters]. *1
|
From Right |
2 | 5 | あB |
String is stored based on the [Number
of characters]. *1
|
*1 If the maximum number of bytes in the [Destination Data] variable is less than the size of the retrieved string, the operation will fail. The maximum number of bytes depends on the encoding of the [Destination Data] variable.