@repl() Function

Top  Previous  Next

@repl() function replaces substrings in a string with another substring and returns the result.

Syntax:

@repl(source-expression, search-for-expressions, replace-with-expressions

 

source-expression 

The string expression in which search-for-expressions to be replaced with replace-with-expressions.

search-for-expressions

The sub-strings to be searched within the source-expression. It can be a single expression or an array of expressions enclosed with "[" and "]" characters and delimited with commas.

replace-with-expressions

The sub-strings to replace the found sub-strings within the the source-expression. It can be a single expression or an array of expressions enclosed with "[" and "]" characters and delimited with commas.

 
Examples:

@repl('--a--b--c--c--b--a--','-b-','*b*') 

 

  @// returns:'--a-*b*-c--c-*b*-a--'

 

 

@repl('<abc>','&','&')

 

  @// returns:'&lt;abc&gt;'

 

 

@set(v:STR,'<aaa>R&D</aaa>')

@repl(v:STR,['&','<','>'],['&amp;','&lt;','&gt;'])

 

  @// returns: '&lt;aaa&gt;R&amp;D&lt;/aaa&gt;'