[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
STRTRAN()
Search and replace characters within a character string or memo field
------------------------------------------------------------------------------
Syntax
STRTRAN(<cString>, <cSearch>,
[<cReplace>], [<nStart>], [<nCount>]) --> cNewString
Arguments
<cString> is the character string or memo field to be searched.
<cSearch> is the sequence of characters to be located.
<cReplace> is the sequence of characters with which to replace
<cSearch>. If this argument is not specified, the specified instances
of the search argument are replaced with a null string ("").
<nStart> is the first occurrence that will be replaced. If this
argument is omitted, the default is one. If this argument is equal to
or less than zero, STRTRAN() returns an empty string.
<nCount> is the number of occurrences to be replaced. If this
argument is not specified, the default is all.
Returns
STRTRAN() returns a new character string with the specified instances of
<cSearch> replaced with <cReplace>.
Description
STRTRAN() is a character function that performs a standard substring
search within a character string. When it finds a match, it replaces
the search string with the specified replacement string. All instances
of <cSearch> are replaced unless <nStart> or <nCount> is specified.
Note that STRTRAN() replaces substrings and, therefore, does not account
for whole words.
Examples
. This example uses STRTRAN() to establish a postmodern analog
to a famous quotation:
cString:= "To compute, or not to compute?"
? STRTRAN(cString, "compute", "be")
// Result: To be, or not to be?
Files Library is CLIPPER.LIB.
See Also:
RAT()
STUFF()
SUBSTR()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson