Swap the contents of two strings
StrSwap( <[@]cString1>, <[@]cString2> ) -> cString
<cString1> [@] and <cString2> [@] Designate the two strings that are interchanged. At least one of the character strings must be passed by reference.
StrSwap() always returns a null string. This function only affects strings that have been passed by reference.
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.
. The character strings are changed directly. Therefore, at least one of the strings must have been passed by reference to get a result.
. 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"
StrSwap() is compatible with CT3’s StrSwap().
Source is strswap.c, library is libct.