CVS() Function - String Data Conversion

Syntax

CVS(string,int{,ERR=lineref})

Description

For BBj-specific information, see the CVS() Function - BBj.

The CVS() function modifies a given string by the value of int from the table below:

Parameter

Description

string

String to be converted.

int

Integer identifying conversion functions, according to the following table.

ERR=lineref

Branch to be taken if an error occurs during execution.

Values for int Parameter

Value

Description

0

Do nothing.

1

Strip leading spaces.

2

Strip trailing spaces.

4

Convert characters to uppercase.

8

Convert characters to lowercase.

16

Convert nonprintable characters to spaces.

32

Replace multiple spaces with a single space.

64

Replace "," and "." characters with values as specified in OPTS (see SETOPTS).

A combination of operations may be specified by adding functional values. For example, CVS(A$,5) strips leading spaces and converts to upper case. CVS(A$,5) is equivalent to CVS(A$,1+4), which is equivalent to CVS(CVS(A$,1),4). When multiple operations are combined in a single CVS() function, they are guaranteed to be applied in ascending numeric order. For example, CVS(A$,1+16+32) first strips leading spaces, then converts non-printable characters to spaces, and finally replaces multiple spaces with a single space. To apply multiple options in a different order, execute the CVS() in a nested manner as shown in the above example.

Examples

0010 LET A$=CVS("    123",1)
0020 PRINT A$
123

See Also

Functions - Alphabetical Listing



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.