
The Function Block SUBSTR cuts out a part of a string and returns it.
Defines the string that is processed.
Defines the start for cutting. The value can also be negative, which means cutting from back to front. The position starts at 0.
The length of the string to cut out. The value can also be negative. Then, the length is limited from back to front. No value or NULL defines no length. FALSE equals 0 and TRUE equals 1.
The input STR contains "Hallo Welt".
| START | LEN | Result |
|---|---|---|
| 1 | NULL | "allo Welt" |
| 1 | 2 | "al" |
| -2 | 2 | "lt" |
| 0 | -2 | "Hallo We" |
| -2 | -1 | "l" |