String.ReplaceAll

Top  Previous  Next

 

Syntax

function String.ReplaceAll(SourceStr: string; SearchStr: string; ReplaceStr: string): string

 

Description

Replaces all occurrences of SearchStr by ReplaceStr in the given SourceStr and Returns this as the new value. The search is case sensitive.

 

To replace all occurrences with a case insensitive search, you can use String.ReplaceAllText.

 

See also

String.Replace
String.ReplaceText
String.ReplaceAllText

 

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