SWAP

SWAP


SUMMATION Index Level SYSTEM
Syntax SWAP( string.expression, search.string, replacement.string {,occurances {,start}} )
Category BASIC
Type Function
Description searches a "string.expression" for the "search.string" and then, if at the "start" occurrence, will replace "search.string" with "replacement.string" for "occurrences" occurrences. If "start" or "occurrences" are omitted, they will default to 1 and 0 respectively. An "occurrence" setting of 0 will replace all occurrences of "search.string" with "replacement.string".
Options
See Also statements & functions string.expression $OPTIONS EREPLACE CHANGE REPLACE
Example nstring = swap("The new time","new","old")
The assigns the value "The old time" to nstring.

print swap("---","-","+",2,1)
This will output "-+-". The "swap" function will replace one occurrence of "-" starting at the second occurrence.
Warnings To use "swap", it is necessary to use a non-default compiler compatibility option.  Inserting the statement "$options ext" at the beginning of the program accomplishes this.
Compatibility D3 7.0 R91
SUMMATION Index Level SYSTEM