previous next top contents index framed top this page unframed
Figure 40–10. $length (GENERIC)
| INTEGER PROCEDURE $length (BOOLEAN v); INTEGER PROCEDURE $length (INTEGER v); INTEGER PROCEDURE $length (LONG INTEGER v); INTEGER PROCEDURE $length (REAL v; OPTIONAL BITS format); INTEGER PROCEDURE $length (LONG REAL v; OPTIONAL BITS format); INTEGER PROCEDURE $length (BITS v; OPTIONAL BITS format); INTEGER PROCEDURE $length (LONG BITS v; OPTIONAL BITS format); |
$length returns the length of the STRING representation of v, as specified by format, if applicable. Specifically:
$length(v)
returns the same value as:
length(cvs(v))
and:
$length(v,format)
the same as:
length(cvs(v,format))
The difference is that $length does not put characters into STRING space, and so is more efficient than the equivalent forms calling length and cvs. However, if the STRING is actually needed later, it is more efficient to call cvs; i.e., instead of:
... $length(v,...); ...; s := cvs(v,...); use s
do:
... length(s := cvs(v,...)); ...; use s
MAINSAIL Language Manual, Section 40.11