Difference between revisions of "STRTRAN()"

From Lianjapedia
Jump to: navigation, search
Line 14: Line 14:
  
  
{|class="30%"|wikitable" width="100%"
+
{|class="wikitable" width="100%"
!width=Parameters||Required||Description
+
!width="30%"|Parameters||Required||Description
 
|-
 
|-
 
|valign="top"|<expC1> &#124; <memofield>||valign="top"|Yes||The character expression or memo field to search.
 
|valign="top"|<expC1> &#124; <memofield>||valign="top"|Yes||The character expression or memo field to search.

Revision as of 07:43, 19 February 2013

Purpose

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

Syntax

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

See Also

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

Description

The STRTRAN() function will search <expC1> or <memofield> and replace <expC2> with <expC3>.

This function can also be used to remove blank spaces in character strings. The STRTRAN() function returns a character expression that contains the result of the string translation.


Parameters Required Description
<expC1> | <memofield> Yes The character expression or memo field to search.
<expC2> Yes The character expression to replace.
<expC3> No The replacement character expression. If <expC3> is not specified, occurrences of <expC2> are removed.
<expN1> No The start occurrence of <expC2> in <expC1> to replace. If <expN1> is not specified then the replacement starts from the first (1) occurrence of <expC2>.
<expN2> No The number of occurrences of <expC2> to replace with <expC3>. If <expN2> is not specified, then all occurrences starting from <expN1> are replaced.
<expN3> No Flag:
0 or -1 = Search is case-sensitive and <expC2> is replaced with <expC3>. (Default)
1 = Search is case-insensitive and <expC2> is replaced with <expC3>.
2 = Search is case-sensitive and <expC2> is replaced with <expC3> changed to match the case of <expC2>.
3 = Search is case-insensitive and <expC2> is replaced with <expC3> changed to match the case of the string found.

Example

? strtran("Hello World", "ello", "i",1,1,1)
Hi World