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

# RightStr

The **RightStr** function returns the substring of the specified length of **ACount** characters that appears at the right side end of the string given in **Atext**.

**Declaration**: Function RightStr(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 := RightStr(Str1, 15);
  LogInfo(Str2);               //Result is  'Quebec, Canada.'
end;
```

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