UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

Related Command UniBasic EXIT 1-165 UniBasic Commands Reference

CONVERT Syntax CONVERT expr1 TO expr2 IN var Description The UniBasic CONVERT command changes all occurrences of the substring expr1 in var to the string expr2. UniBasic compares each character of the replacement string expr2 and, if necessary, replaces each character of the target string expr1 on an individual basis. UniBasic does not compare and insert strings as a whole. CONVERT supports multibyte languages. CONVERT can delete characters from a string, but it does not insert additional characters. If the replacement substring expr2 contains more characters than are in the substring it replaces (expr1), the extra characters are ignored. Parameters The following table describes each parameter of the syntax. Examples Parameter Description expr1 Specifies the target string to replace with expr2. expr2 Specifies the string with which to replace expr1. var Specifies the string to search for expr1. CONVERT Parameters In the following example, the program segment converts all occurrences of 1 to 3 and all occurrences of 2 to 4. The new contents of NSTRING becomes 34,0,03,35,44. NSTRING = "12,0,01,15,22" CONVERT "12" TO "34" IN NSTRING CONVERT 1-166

CONVERT<br />

Syntax<br />

CONVERT expr1 TO expr2 IN var<br />

Description<br />

The <strong>UniBasic</strong> CONVERT command changes all occurrences of the substring expr1<br />

in var to the string expr2. <strong>UniBasic</strong> compares each character of the replacement<br />

string expr2 and, if necessary, replaces each character of the target string expr1 on an<br />

individual basis. <strong>UniBasic</strong> does not compare and insert strings as a whole.<br />

CONVERT supports multibyte languages.<br />

CONVERT can delete characters from a string, but it does not insert additional<br />

characters. If the replacement substring expr2 contains more characters than are in<br />

the substring it replaces (expr1), the extra characters are ignored.<br />

Parameters<br />

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

Examples<br />

Parameter Description<br />

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

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

var Specifies the string to search for expr1.<br />

CONVERT Parameters<br />

In the following example, the program segment converts all occurrences of 1 to 3 and<br />

all occurrences of 2 to 4. The new contents of NSTRING becomes 34,0,03,35,44.<br />

NSTRING = "12,0,01,15,22"<br />

CONVERT "12" TO "34" IN NSTRING<br />

CONVERT 1-166

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

Saved successfully!

Ooh no, something went wrong!