Skip to content

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 and ReplaceText.

Also see the RightStr, LeftStr, and MidStr functions RightStr, MidStr and LeftStr.