
Replace a portion of a string with a new value
Member of Unicode Intrinsic Functions (PRIM_LIBI.IUnicodeIntrinsics)
Parameters
Name | Type | Data Type | Description |
---|---|---|---|
Result | *Result (Optional) | Unicode String | Resulting string |
StartPosition | *Input | Integer | Position at which to start the replacing characters |
Length | *Input | Integer | Number of characters to replace |
With | *Input | Unicode String | String to insert |
Pad | *Input (Optional) | Unicode String | Pad character used to replace blanks in the result |
Details
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.
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" "*" )
See also
LANSA Version 15, April 2020