| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Exchanges adjacent words (2-byte sequences) in a string.
WordSwap( <cString>, [<lSwapBytes>] ) --> cResult
The function returns the modified character string.
| See also: | CharSort(), CharSwap() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\charswap.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// 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
http://www.xHarbour.com