21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

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.

Documentation/<strong>BASIC</strong> <strong>Guide</strong>/Runtime Library 43<br />

Runtime Library<br />

Documentation/ <strong>BASIC</strong> <strong>Guide</strong>/<br />

Runtime Library<br />

The following sections present the central functions of the runtime library:<br />

• Conversion Functions<br />

• Strings<br />

• Date and Time<br />

• Files and Directories<br />

• Message and Input Boxes<br />

• Other Functions<br />

Source: http:/ / <strong>wiki</strong>. services. openoffice. <strong>org</strong>/ w/ index. php? title=Documentation/ <strong>BASIC</strong>_<br />

<strong>Guide</strong>/ Runtime_ Library&oldid=107793<br />

Principal Authors: Fpe, Ccornell, TJFrazier<br />

Conversion Functions<br />

In many situations, circumstances arise in which a variable of one type has to be changed<br />

into a variable of another type.<br />

Implicit and Explicit Type Conversions<br />

The easiest way to change a variable from one type to another is to use an assignment.<br />

Dim A As String<br />

Dim B As Integer<br />

B = 101<br />

A = B<br />

In this example, variable A is a string, and variable B is an integer. <strong>OpenOffice</strong>.<strong>org</strong> Basic<br />

ensures that variable B is converted to a string during assignment to variable A. This<br />

conversion is much more elaborate than it appears: the integer B remains in the working<br />

memory in the form of a two-byte long number. A, on the other hand, is a string, and the<br />

computer saves a one- or two-byte long value for each character (each number). Therefore,<br />

before copying the content from B to A, B has to be converted into A's internal format.<br />

Unlike most other programming languages, Basic performs type conversion automatically.<br />

However, this may have fatal consequences. Upon closer inspection, the following code<br />

sequence

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

Saved successfully!

Ooh no, something went wrong!