LEFT block
Short summary
Name |
|
→POU type |
|
Category |
|
Conform to →IEC-standard |
currently restricted
|
Graphical interface |
|
Available since |
version 1.32.0 (for Neuron Power Engineer) |
Functionality
The block returns a partial string of another string – starting at the leftmost position.
At input IN
, enter a string. At input L
, enter the number of characters to return (= the length of the part to return).
Special cases (see under "Example for usage within ST-editor"):
-
In case of
L = 0
, the block returns an empty string''
. In this case, the outputENO
is set to valueTRUE
. -
If the value for
L
is > the length of the string value forIN
, the block returns the string as connected toIN
. In this case, the outputENO
is set to valueFALSE
. -
If a negative value is connected to
L
, the block returns an empty string''
. In this case, the outputENO
is set to valueFALSE
as well.
Neuron Power Engineer determines the character positions within a string as follows: 1
, 2
, ..., n. 1
corresponds to the leftmost character position and n
to the length of the string.
Three-character combination of the dollar sign ($
) followed by two hexadecimal digits are evaluated as single character. Example: The string '$B15
' (corresponds to '±5
') consists of 2 characters. See →character string literal for more examples for those combinations.
Inputs, return value
|
Identifier |
Description |
|
---|---|---|---|
Inputs: |
|
|
input value |
|
|
number of characters to return |
|
Return value: |
– |
|
|
Input EN
and output ENO
are available when →calling the block. See "Execution control: EN, ENO" for information on input EN
and output ENO
.
See:
-
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
-
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic.
Internal error diagnostic for block
The block checks the would-be return value.
If the return value cannot be mapped in the available memory (the return value is too large), the output ENO
of the block is set to value FALSE
(or an equivalent). When you are using nested blocks with STRING
values, observe that the memory for STRING
values is restricted (see "In case of nested string blocks: How can the return value be entirely mapped ?" for details and examples).
Moreover, the block checks the connected values whether a non-existent character position in a string is accessed. This is the case, if the value for L
is > the length of the string value for IN
or a negative value is connected to L
. The output ENO
of the block is set to value FALSE
(or an equivalent) in both these cases.
Example for usage within ST-editor
|
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.