[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 CHARSWAP()
 Exchanges all adjoining characters in a string
------------------------------------------------------------------------------
 Syntax

     CHARSWAP(<cString>) --> cString

 Argument

     <cString>  [@]  Designates the character string that is processed.

 Returns

     The processed character string is returned.

 Description

     CHARSWAP() takes all neighboring characters in <cString> and exchanges
     them.  As a result, bytes in even positions are exchanged for those in
     odd positions.

     CHARSWAP() is very important when you use string integers generated by
     the CA-Clipper I2BIN() function that must be saved or sorted.  The
     CHARSWAP() exchange must be carried out prior to calling CHARSORT()
     (low/high ordering of 16-bit integers) to achieve an accurate result.

 Notes

     .  Since the length of the character string is not changed, a
        call by reference is recommended.  This increases the speed of the
        function.

     .  The value this function returns can be suppressed by setting
        CSETREF() to save working memory space.

 Examples

     .  Exchange characters that can be displayed:

        ? CHARSWAP("0123456789")               // "1032547698"

     .  Work with I2BIN:

        ? I2BN(256)                            // 00000000 00000001
        ? I2BIN(1)                             // 00000001 00000000
        ? I2BIN(256) > I2BIN(1)                          // .F.
        ? CHARSWAP(I2BIN(256)) > CHARSWAP(I2BIN(1))      // .T.


See Also: WORDSWAP() CHARSORT() CSETREF()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson