Get String Length

Gets the number of characters of the string in [Source Data] and stores the value to [Destination Data].

Block
Text

TARGET = length(EXPRESSION);
  1                 2

# Description
1 [Destination Data]
Set the destination where you want to store the length of the string. The length of the string is stored as an integer value.
2 [Source Data]
Set the source data where the string is stored. If using an external variable, the string is encoded in the [String Encode] setting in the associated equipment. Otherwise, the string is encoded in UTF-8.

(Example)

Block

 

Text

Var1 = length(Var3);

 

Operation Example

Variable in [Source Data]

Variable in [Destination Data]

Comments
String

Maximum Number of Bytes

Data Type Obtained number of characters
ABCDE

5

INT 5 -
AB

5

INT 2 -
Aあ

5

INT 2 The number of characters of the string is stored.
AA

[Variable Length] enabled in the Variable property window

INT 2 -
Aあ

[Variable Length] enabled in the Variable property window

INT 2 The number of characters of the string is stored.
A(0x00)CDE

5

INT 1
If there is a NULL (0x00), the string is terminated there.
(0x00)

5

INT 0
If there is a NULL (0x00), the string is terminated there.
A(0x0A)CD

5

INT 4 Line feed code (0x0A) is regarded as a character.
A(0x0D)CD

5

INT 4 Return code (0x0D) is regarded as a character.