REPLRIGHT()
Replace certain characters at the right of a string
Syntax
REPLRIGHT( <cString>, <cReplace|nReplace>, [<cSearch|nSearch>] ) -> cString
Arguments
<cString> [@] Designates the string that is processed.
<cReplace|nReplace> Designates the character that replaces the character in <cSearch|nSearch> at the end of the <cString>.
<cSearch|nSearch> Designates the character at the end of <cString> that is replaced by <cReplace|nReplace>. The default value is a space, CHR(32).
Returns
The processed <cString> is returned.
Description
REPLRIGHT() can be used to exchange all trailing characters in a string for any character choosen.
Note
. The return value of this function can be suppressed by implementing CSETREF() to save space in working memory.
Examples
. Replace the trailing spaces with dashes: ? REPLRIGHT("abcd ", "-") // "abcd--" . Replace the trailing dashes with spaces: ? REPLRIGHT("abcd--", " ", "-") // "abcd " . Replace only the trailing spaces: ? REPLRIGHT(" 1 ", "-") // " 1--"
Compliance
REPLRIGHT() is compatible with CT3’s REPLRIGHT().
Platforms
All
Files
Source is replace.c, library is libct.
Seealso
REPLALL(), REPLLEFT(), CSETREF(), Introduction