MLEN (string length)
The MLEN instruction calculates the length of a string.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
MLEN

Parameter | Parameter Type | Data Type | Description |
---|---|---|---|
EN | Input | BOOL | Instruction enable.
Applies to ladder diagram programs. |
IN | Input | STRING | Any string. |
MLEN | Output | DINT | Number of characters in the IN string. |
ENO | Output | BOOL | Enable output. Applies to ladder diagram programs. |
MLEN examples
MLEN function block diagram example

MLEN ladder diagram example

MLEN structure text example

(* ST Equivalence: *) nbchar := MLEN (complete_string); If (nbchar < 3) Then Return; End_if; prefix := LEFT (complete_string, 3); (* this program extracts the 3 characters on the left of the string and puts the result in the prefix string variable. Nothing is done if the string length is less than 3 characters *)
Results

Provide Feedback