---
url: >-
  /statelake/scripting-reference/functions-and-procedures/string-functions/leftstr.md
---

# LeftStr

The **LeftStr** function returns the substring of the specified length of **ACount** characters that appears at the starting left side of the string given in **Atext**.

**Declaration**: Function LeftStr(const AText : string; const ACount : Integer) : string;

An example is.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  Str1, Str2 : string;
begin
  Str1 := 'Kathy Reichs is a forensic anthropologist to the province of Quebec, Canada.'
  Str2 := LeftStr(Str1, 12);
  LogInfo(Str2);               //Result is  'Kathy Reichs'
end;
```

Also see the **RightStr** and **MidStr** functions [RightStr](/statelake/scripting-reference/functions-and-procedures/string-functions/rightstr) and [MidStr](/statelake/scripting-reference/functions-and-procedures/string-functions/midstr) .
