Difference between revisions of "STR REPLACE()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
{{YLM to do}}
 
 
 
==Class==
 
==Class==
 
+
String Data
  
  
 
==Purpose==
 
==Purpose==
 
+
Function to search for and replace text within a character string or memo field
  
  
 
==Syntax==
 
==Syntax==
 
+
STR_REPLACE(<expC1> | <memofield>, [<expC2>, <expC3>, [<expN1> [,<expN2>]]])
  
  
 
==See Also==
 
==See Also==
 
+
[[AT()]], [[ATNEXT()]], [[CHRTRAN()]], [[INLIST()]], [[LEFT()]], [[OCCURS()]], [[RAT()]], [[RIGHT()]], [[STR()]], [[STR_REPLACE()]], [[STREXTRACT()]], [[STUFF()]], [[SUBSTR()]]
  
  
 
==Description==
 
==Description==
 
+
The STR_REPLACE() function will search <expC1> or <memofield> and replace text within <expC1> or <memofield> with <expC3> wherever the occurrence of <expC2> is found.  The optional <expN1> specifies the start position for the search in <expC1>.  If this is not specified then the default is 1.  The optional <expN2> specifies the number of occurrences of <expC2> to replace with <expC3>.  If this is not specified, then all occurrences starting from <expN1> are replaced.  This function can be used to remove blank spaces in character strings.  The STR_REPLACE() function returns a character expression that contains the result of the string translation.
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
 
+
? str_replace("ello", "i","Hello World")
 +
Hi World
 
</code>
 
</code>
  
==Products==
 
  
 +
==Products==
 +
Recital Server, Recital
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
[[Category:String Data]]
 +
[[Category:String Data Functions]]

Revision as of 12:29, 13 October 2009

Class

String Data


Purpose

Function to search for and replace text within a character string or memo field


Syntax

STR_REPLACE(<expC1> | <memofield>, [<expC2>, <expC3>, [<expN1> [,<expN2>]]])


See Also

AT(), ATNEXT(), CHRTRAN(), INLIST(), LEFT(), OCCURS(), RAT(), RIGHT(), STR(), STR_REPLACE(), STREXTRACT(), STUFF(), SUBSTR()


Description

The STR_REPLACE() function will search <expC1> or <memofield> and replace text within <expC1> or <memofield> with <expC3> wherever the occurrence of <expC2> is found. The optional <expN1> specifies the start position for the search in <expC1>. If this is not specified then the default is 1. The optional <expN2> specifies the number of occurrences of <expC2> to replace with <expC3>. If this is not specified, then all occurrences starting from <expN1> are replaced. This function can be used to remove blank spaces in character strings. The STR_REPLACE() function returns a character expression that contains the result of the string translation.


Example

? str_replace("ello", "i","Hello World")
Hi World


Products

Recital Server, Recital