CT_STRSWAP

 STRSWAP()
 Interchanges two strings
------------------------------------------------------------------------------
 Syntax

     STRSWAP(<cString1>,<cString2>) --> cString

 Arguments

     <cString1>  [@] and <cString2>  [@]  Designate the two strings
     that are interchanged.  At least one of the character strings must be
     passed by reference.

 Returns

     STRSWAP() always returns a null string.  This function only affects
     strings that have been passed by reference.

 Description

     STRSWAP() interchanges the strings <cString1> and <cString2>.  The
     exchange continues until all the characters in the shorter character
     string have been moved.  The function terminates when the last character
     of the shortest string is exchanged.

 Note

     .  The character strings are changed directly.  Therefore, at
        least one of the strings must have been passed by reference to get a
        result.

 Examples

     .  In this example, two strings are passed by reference:

        cStr1  :=  "1234567890"
        cStr2  :=  "ABCDEFGHIJKLM"
        ? STRSWAP(@cStr1, @cStr2)      // Return value: ""

     .  The two strings subsequently contain these characters:

        ? cStr1                        // "ABCDEFGHIJ"
        ? cStr2                        // "1234567890KLM"

     .  In this example, only one of the strings is passed by
        reference:

        cStr1  :=  "1234567890"
        cStr2  :=  "ABCDEFGHIJKLM"
        ? STRSWAP(cStr1, @cStr2)       // Return value: ""

     .  Both strings subsequently contain the characters of the string
        passed by reference:

        ? cStr1                        // "1234567890"
        ? cStr2                        // "1234567890KLM"

See Also: Introduction

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.