|
StrTran()
Search and replace characters within a character
string.
Syntax
Strtran(<cString>, <cSearch>,
[<cReplace>], [<nStart>], [<nCount>]) -->
cNewString
Arguments
<cString> --> is the character string to
search.
<cSearch> --> is the sequence of
characters to locate.
<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/empty string ("").
<nStart> is the first occurrence that will
be replaced. If this argument is omitted, the default is one.
<nCount> is the number of occurrences to
replace. 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
Strtran('Hello John,
how are you?', 'John', 'Mike')
* Result: 'Hello Mike,
how are you?'
____________________________
Related Topics
Business
Function List
|