Unicode Intrinsic Functions - ReplaceSubstring Method

Replace a portion of a string with a new value

Member of Unicode Intrinsic Functions (PRIM_LIBI.IUnicodeIntrinsics)

Parameters

NameTypeData TypeDescription
Result*Result (Optional)Unicode StringResulting string
StartPosition*InputIntegerPosition at which to start the replacing characters
Length*InputIntegerNumber of characters to replace
With*InputUnicode StringString to insert
Pad*Input (Optional)Unicode StringPad 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

All Component Classes

Technical Reference

Febuary 18 V14SP2