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

# StuffString

The **StuffString** function stuffs (or inserts) the substring specified by **ASubText**, into the string given in **Atext**, starting at the specified character **AStart**, for the length of **ALength** characters.

**Declaration**: Function StuffString(const AText : string; AStart, ALength : Cardinal; const ASubText : string) : 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 := StuffString(Str1, 19, 23, 'Psychodynamic Psychotherapist');
 //Result is  'Kathy Reichs is a Psychodynamic Psychotherapist to the province of Quebec, Canada.'
  LogInfo(Str2);
end;
```

For similar functions, please review [ReplaceStr](/statelake/scripting-reference/functions-and-procedures/string-functions/replacestr) and [ReplaceText](/statelake/scripting-reference/functions-and-procedures/string-functions/replacetext).

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