11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Examples<br />

In the following example, the program segment extracts the first character of the<br />

variable LAST.NAME (in this case, an S):<br />

LAST.NAME = 'Smith'<br />

L.INITIAL = LAST.NAME[1,1]<br />

In the next example, the program segment changes the first letter of the word Bind in<br />

the variable TITLE to W. The resulting string is “Gone with the Wind”.<br />

TITLE = 'Gone with the Bind'<br />

TITLE[15,1] = 'W'<br />

In the next example, the program segment changes the substring 234 spaces:<br />

A = "12345"<br />

A[2,3] = ""<br />

In BASICTYPE U, system output is as follows:<br />

A = "1 5"<br />

In BASICTYPEs M and P, the substring is extracted as follows:<br />

A = "15"<br />

The following program inserts the null value into string X, which contains 12345, and<br />

then prints this element before and after converting @NULL to the printable string<br />

“@NULL”:<br />

X=12345<br />

X[3,1]=@NULL<br />

PRINT "X[3,1] is printed on the next line."<br />

PRINT X[3,1]<br />

X = CHANGE(X[3,1], @NULL,"@NULL")<br />

PRINT "X[3,1] is printed on the next line."<br />

PRINT X<br />

This program prints the following text:<br />

X[3,1] is printed on the next line.<br />

X[3,1] is printed on the next line.<br />

@NULL<br />

[] 1-68

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

Saved successfully!

Ooh no, something went wrong!