String.ReplaceAllText

Top  Previous  Next

 

Syntax

function String.ReplaceAllText(SourceTxt: string; SearchTxt: string; ReplaceTxt: string): string

 

Description

Replaces all occurrences of SearchTxt by ReplaceTxt in the given SourceTxt and Returns this as the new value. The search is case insensitive.

 

To replace all occurrences with a case sensitive search, you can use String.ReplaceAll.

 

See also

String.Replace
String.ReplaceAll
String.ReplaceText

 

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