Copy / Pos
Substring extraction and searching.
Syntax
Copy(s, start, length) · Pos(alt, s)
Description
Copy(s, 1, 3) gets 3 characters from the start (1-indexed!). Pos gives the position of the substring (0 if not found).
Example
Loading editor…
Expected output
Hex 4
When to use?
Text slicing, searching.
Common mistakes
- ⚠️ Pascal/Delphi string indexing starts at 1: Copy(s,1,3) is the first 3 characters.