HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to DelphiVariablesData Types & ConversionOperatorsStringsConditions (if)Loops (for / while)Functions
REFERENCE
📖 Overview
🖥️ Output
📦 Variables
🔄 Data Types & Conversion
✍️ String
+ / LengthUpperCase / LowerCaseCopy / Pos
🔁 Condition & Loop
🧩 Function & Procedure
Delphi›REFERENCE›String›Copy / Pos

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.

Related commands

+ / Length
← UpperCase / LowerCase
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code