2.5.4.84 Replace

The Replace function replaces part of a text string with another text string.

ABNF:

 Replace = val val val val " REPLACE():128"

Required Arguments:

Name: SourceText

Type: vString

An argument that specifies the string to perform replacement on.

Name: StartPos

Type: vSignedLong

An argument that specifies the one-based starting position in SourceText where replacement begins.

Name: NumChars

Type: vSignedLong

An argument that specifies the number of characters in SourceText to be replaced by ReplaceText.

Name: ReplaceText

Type: vString

An argument that specifies the string to use for replacement.

Return Value:

Type: PtgStr1, PtgErr

This function returns a PtgStr1 containing SourceText modified with the replaced text. If StartPos is less than or equal to zero or greater than the number of characters in SourceText, the function returns a PtgStr1 containing SourceText with ReplaceText appended at the end. If StartPos plus NumChars minus one exceeds the length of SourceText, or if NumChars is less than zero, the function returns a PtgStr1 containing SourceText truncated starting from StartPos and with ReplaceText appended at the end.