xHarbour Reference Documentation > Function Reference |
Exchanges characters between two strings.
StrSwap( [@]<cString1> , [@]<cString2> ) --> cNull
The function exchanges characters between <cString1> and <cString2> beginning with the first character up to the length of the shorter string. To obtain a result, at least one parameter must be passed by reference. The return value is always a null string ("").
Category: | CT:String manipulation , Character functions |
Source: | ct\strswap.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example shows results of StrDiff() passing either // parameter or both by reference PROCEDURE Main LOCAL cStr1, cStr2 cStr1 := "xHarbour compiler" cStr2 := "01234567" StrSwap( cStr1, @cStr2 ) ? cStr1 // result: xHarbour compiler ? cStr2 // result: xHarbour cStr1 := "xHarbour compiler" cStr2 := "01234567" StrSwap( @cStr1, cStr2 ) ? cStr1 // result: 01234567 compiler ? cStr2 // result: 01234567 cStr1 := "xHarbour compiler" cStr2 := "01234567" StrSwap( @cStr1, @cStr2 ) ? cStr1 // result: 01234567 compiler ? cStr2 // result: xHarbour RETURN
http://www.xHarbour.com