String.Replace |
Top Previous Next |
Syntax function String.Replace(SourceStr: string; SearchStr: string; ReplaceStr: string; ReplaceFlags: integer): string
Alternative Names
Description Replaces one or more occurrences of SearchStr by ReplaceStr in the given SourceStr and Returns this as the new value. By default, the search is case sensitive and by default only the first occurrence is replaced. This behaviour can be modified using the ReplaceFlags.
ReplaceFlags is either 0 or a combination of the following:
To replace case insensitive, you can also use String.ReplaceText, there are other routines for replacing as well.
See also
Example execute udsblock as begin /* replace first 'in', search case insensitive returns 'Output Input' */ valueout = String.Replace('Input Input', 'in', 'Out', __rfIgnoreCase);
/* replace all 'In', search case sensitive returns 'input Output Output' */ valueout = String.ReplaceAll('input Input Input', 'In', 'Out');
/* replace first 'in', search case insensitive returns 'Output Input' */ valueout = String.ReplaceText('Input Input', 'in', 'Out');
/* replace all 'in', search case insensitive returns 'Output Output' */ valueout = String.ReplaceAllText('Input Input', 'in', 'Out'); end |