xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

WordSwap()

Exchanges adjacent words (2-byte sequences) in a string.

Syntax

WordSwap( <cString>, [<lSwapBytes>] ) --> cResult

Arguments

<cString>
This is the character string to process.
<lSwapBytes>
This parameter defaults to .F. (false) so that the function exchanged adjacent 2-byte sequences (words) in <cString>. When set to .T. (true), the function also exchanges the high and low bytes in each word.

Return

The function returns the modified character string.

Info

See also:CharSort(), CharSwap()
Category: CT:String manipulation , Character functions
Source:ct\charswap.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines the effect of WordSwap() with
// the second parameter set to .F. and .T.

   PROCEDURE Main
      LOCAL cString := "ABCD"

      ? WordSwap( cString )            // result: CDAB

      ? WordSwap( cString, .T. )       // result: DCBA
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe