10 6 52 ReplaceSubstring

LANSA Technical

10.6.52 ReplaceSubstring

ReplaceSubstring replaces the characters from the StartPosition for the specified length with the contents of the With parameter.

If the length exceeds the available characters, the remainder is ignored.

Input Parameters

Startposition - Character at which to start replacing

Length - Number of characters to replace

With - Replacement string

Pad - Pad character to be used when the StartPosition is beyond the length of the string.

Example

In this example, if #String contained 'ABCDE', the result would be 'XYZDE':

#Com_owner.Caption := #String.ReplaceSubstring( 1 3 'XYZ' )

 

In this example, if #String contained 'ABCDE', the result would be 'AXYZCDE':

#Com_owner.Caption := #String.ReplaceSubstring( 2 1 'XYZ' )

 

In this example, if #String contained 'ABCDE', the result would be 'ABCDE****XYZ':

#Com_owner.Caption := #String.ReplaceSubstring( 10 1 'XYZ' '*' )

 

Ý 10.6 Alphanumeric/String Intrinsic Functions