Replace a portion of a string with a new value
Member of String Intrinsic Functions (PRIM_LIBI.ICommonStringIntrinsics)
Name | Type | Data Type | Description |
---|---|---|---|
Result | *Result (Optional) | String | Resulting string |
StartPosition | *Input | Integer | Position at which to start the replacing characters |
Length | *Input | Integer | Number of characters to replace |
With | *Input | String | String to insert |
Pad | *Input (Optional) | String | Pad character used to replace blanks in the result |
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.
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" "*" )
Febuary 18 V14SP2