STRTRAN()

From Lianjapedia
Jump to: navigation, search

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 = Same as 0.
3 = Same as 1.

Example

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