STRTRAN( ) Function

Example   See Also

Searches a character expression or memo field for occurrences of a second character expression or memo field, and then replaces each occurrence with a third character expression or memo field.

Syntax

STRTRAN(cSearched, cSearchFor [, cReplacement]
  [, nStartOccurrence] [, nNumberOfOccurrences])

Returns

Character

Arguments

cSearched

Specifies the character expression that is searched. cSearched can be a memo field.

cSearchFor

Specifies the character expression that is searched for in cSearched. The search is case-sensitive. cSearchFor can be a memo field.

cReplacement

Specifies the character expression that replaces every occurrence of cSearchFor in cSearched. If you omit cReplacement, every occurrence of cSearchFor is replaced with the empty string.

nStartOccurrence

Specifies which occurrence of cSearchFor is the first to be replaced. For example, if nStartOccurrence is 4, replacement begins with the fourth occurrence of cSearchFor in cSearched and the first three occurrences of cSearchFor remain unchanged. The occurrence where replacement begins defaults to the first occurrence of cSearchFor if you omit nStartOccurrence.

nNumberOfOccurrences

Specifies the number of occurrences of cSearchFor to replace. If you omit nNumberOfOccurrences, all occurrences of cSearchFor, starting with the occurrence specified with nStartOccurrence, are replaced.

Remarks

You can specify where the replacement begins and how many replacements are made. STRTRAN( ) returns the resulting character string.