# CODESYS LEFT

Instructions · `LEFT` · verification: source checked

LEFT is a string function that returns a specified number of characters from the start of a string. It takes a STRING(255) input and an INT size, and returns a STRING(255); LEFT('SUSI',3) returns 'SUS'.

## Specification

| Property | Value |
|---|---|
| Language | iec 61131 3 |
| Code | LEFT |
| Group | String Functions |
| Syntax | LEFT (STR, SIZE) |
| Dialect | CODESYS |

### Parameters

| Name | Data type | Description |
|---|---|---|
| STR | STRING(255) | String to be analyzed |
| SIZE | INT | Number of characters |

## Study notes

- The function declaration is FUNCTION LEFT : STRING(255).
- The return value is a STRING(255) resulting string.
- Example: VarSTRING1 := LEFT('SUSI',3); the result is 'SUS'.

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74417163.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/libs/Standard/Current/String-Functions/LEFT.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-left  
JSON: https://machineschema.com/instruction/iec-left.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
