11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SWAP<br />

Syntax<br />

SWAP str.expr1 WITH str.expr2 IN var<br />

Description<br />

The <strong>UniBasic</strong> SWAP command replaces all occurrences of one substring with a<br />

second substring. The search string does not have to be the same length as the<br />

replacement string. SWAP supports mulitbyte languages.<br />

Tip: CONVERT compares and replaces substrings on a character-by-character<br />

basis. CONVERT cannot exchange strings of different lengths.<br />

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

str.expr1 Specifies the string expression to replace with str.expr2.<br />

str.expr2 Specifies the string expression with which to replace str.expr1.<br />

IN var Specifies the variable in which to replace str.expr1 with str.expr2.<br />

SWAP Parameters<br />

Examples<br />

In the following example, the program segment replaces all occurrences of the string<br />

“AB” with the string “AZ” in the variable VAR. The new string assigned to VAR is<br />

“THE TAZ WAS GRAZBED”.<br />

VAR = "THE TAB WAS GRABBED"<br />

SWAP "AB" WITH "AZ" IN VAR<br />

SWAP 1-891

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!