[Overview][Resource strings][Constants][Types][Procedures and functions][Index] | Reference for unit 'StrUtils' (#rtl)

# StuffString

Replace part of a string with another string.

## Declaration

Source position: strutils.pp line 74

`function StuffString(`
`const AText: string;`
`AStart: Cardinal;`
`ALength: Cardinal;`
`const ASubText: string`
`):string;`

## Arguments

`AText` |  | Text on which to operate.
`AStart` |  | Start of section to be replaced.
`ALength` |  | Length of section to be replaced.
`ASubText` |  | Text to insert at the indicated position.

## Function result

Resulting string with indicated section replaced.

## Description

StuffString returns a copy of AText with the segment starting at AStart with length ALength, replaced with the string ASubText. Basically it deletes the segment of Atext and inserts the new text in it's place.

## Errors

No checking on the validity of the AStart and ALength parameters is done. Providing invalid values may result in access violation errors.

## See also

FindPart |  | Search for a substring in a string, using wildcards.
DelChars |  | Delete all occurrences of a given character from a string.
DelSpace |  | Delete all occurrences of a space from a string.
ExtractSubStr |  | Extract a word from a string, starting at a given position in the string.
DupeString |  | Creates and concatenates N copies of a string