Difference between revisions of "CHRTRANC()"

From Lianjapedia
Jump to: navigation, search
Line 9: Line 9:
  
 
==Description==
 
==Description==
The CHRTRAN() function will search <expC1> or <memofield> and replace text within <expC1> or <memofield> with <expC3> wherever the occurrence of <expC2> is found.  If <expC3> is not specified, instances of the text in <expC2> are removed.  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 CHRTRANC() function returns a character expression that contains the result of the string translation.
+
The CHRTRANC() function will search <expC1> or <memofield> and replace text within <expC1> or <memofield> with <expC3> wherever the occurrence of <expC2> is found.  If <expC3> is not specified, instances of the text in <expC2> are removed.  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 CHRTRANC() function returns a character expression that contains the result of the string translation.
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
cDBreplaced = chrtranc(cDBstring, cDBstringreplace, cDBstringreplacewith)
+
cDBreplaced = chrtranc(cDBString, cDBReplace, cDBReplaceWith, nStart, nOccurrences)
 
</code>
 
</code>
 
   
 
   

Revision as of 07:41, 15 September 2014

Purpose

Function to search for and replace text within a character string or memo field (double byte character sets)

Syntax

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

See Also

AT(), AT_C(), ATNEXT(), CHRTRAN(), LEFT(), LEFTC(), LEN(), LENC(), MTOS(), RAT(), RAT_C(), RIGHT(), RIGHTC(), SET STRESCAPE, STR(), STREXTRACT(), STRTRAN(), STRZERO(), STUFF(), STUFFC(), SUBSTR(), SUBSTRC(), TRIM()

Description

The CHRTRANC() function will search <expC1> or <memofield> and replace text within <expC1> or <memofield> with <expC3> wherever the occurrence of <expC2> is found. If <expC3> is not specified, instances of the text in <expC2> are removed. 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 CHRTRANC() function returns a character expression that contains the result of the string translation.

Example

cDBreplaced = chrtranc(cDBString, cDBReplace, cDBReplaceWith, nStart, nOccurrences)