User Tools

Site Tools


syntax:functions:replace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
syntax:functions:replace [2015/04/03 18:33] elenapsyntax:functions:replace [2025/03/18 17:00] (current) – [See also] craigt
Line 1: Line 1:
-===== Replace(text, old_stringnew_string) =====+======Replace(text, old_textnew_text) =====
 +Category:  Text function 
 + 
 +\\  
 +=====Description===== 
 +This function replaces all instances of //old_text// with //new_text// within //text//. 
 + 
 +\\  
 +=====Arguments===== 
 +^Argument^Type^Description^ 
 +|text|Text|Any text value or value that can be implicitly converted to text.| 
 +|old_text|Text|The text  to be found within //text// and replaced by //new_text//, if found.| 
 +|new_text|Text|The text that replaces //old_text// if found within //text//.| 
 + 
 +**Return value type:** Text 
 + 
 +\\  
 +=====Remarks===== 
 +This function is case sensitive. 
 + 
 +Entering '' (two single quotes; an empty string) as the //new_text// value has the same effect as using the [[syntax:functions:removetext|RemoveText]] function. 
 + 
 +Number values entered for //text//, //old_text//, and //new_text// are implicitly converted to text. 
 + 
 +\\  
 +=====Examples===== 
 + 
 +  replace('Food & Beverage', '&', 'and') //Returns 'Food and Beverage' 
 + 
 +  replace('New York', 'york', 'Orleans') //Returns 'New York' ('york' isn't found due to the case of 'y'.) 
 + 
 +  replace('New Mexico', ' ', '_') //Returns 'New_Mexico' (Replaces spaces with underscores.) 
 + 
 +  replace(123456789, 456, 654) //Returns '123654789' (Number implicitly converted; return value is text.) 
 + 
 +  replace(190091, "00", 5) //Returns '19591' (Enter multiple zeroes as text; return value is text.) 
 + 
 +\\  
 +=====See also===== 
 +  * [[syntax:functions:regexreplace|RegExReplace(text, replace_text, regex_text)]] 
 +  * [[syntax:functions:removetext|RemoveText(text, string)]] 
 +  * [[syntax:functions:replace|Replace(text, string_old, string_new)]] 
 +  * [[syntax:functions:replacebetween|ReplaceBetween(text, string1, contents, string2 [,N])]] 
 +  * [[syntax:functions:replacebetweenmany|ReplaceBetweenMany(text, string1, contents, string2 [,N])]] 
  
-Replaces all entries of the //old_string// in the //text// with the //new_string//. 
  
-All arguments are implicitly converted into text, if required. 
  
-^  Example  ^  Result  ^ 
-|  replace('Food & Beverage', '&', 'and'   Food and Beverage  | 
-|  replace('New York City', 'York City', 'Orleans' |  New Orleans  | 
syntax/functions/replace.1428100403.txt.gz · Last modified: 2015/04/03 18:33 by elenap

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki