[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
POSREPL()
Replaces one or more characters from a certain position
------------------------------------------------------------------------------
Syntax
POSREPL(<cString>,<cReplacementstring>,
[<nStartPos>]) --> cString
Arguments
<cString> [@] Designates the character string within which the
particular characters are replaced.
<cReplacementstring> Designates a sequence of characters that,
starting at <nStartPos>, replace a portion of <cString>.
<nStartPos> Designates from which character within <cString> the
replacement starts.
Returns
POSREPL() returns the modified string.
Description
When you use POSREPL(), you can replace a range of characters within
<cString> with another character string <cReplacementstring>. The new
characters are exchanged beginning at <nStartPos>.
Notes
. When the <nStartPos> parameter is not specified, the
<cReplacementstring> overwrites the end of the string (see examples).
. The return value of this function can be suppressed by
implementing CSETREF() to save space in working memory.
Examples
. Starting at position 3, replace three characters with "XXX":
? POSREPL("ABCDEFG", "XXX", 3) // "ABXXXFG"
. Replace the last LEN(<cReplacementstring>) characters:
? POSREPL("ABCDEFG", "XXX") // "ABCDXXX"
. The result can be longer than the character string passed.
? POSREPL("ABCDEF", "123", 5) // "ABCD123"
? POSREPL("ABCDEF", "123", 6) // "ABCDE123"
See Also: POSINS() POSDEL() CSETREF()
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson