CVS() Function

BBj-Specific Information

For this topic's original documentation, see the CVS() Function.

Syntax

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

Description

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.

char

Optional parameter that can be used to modify any CVS function that normally manipulates spaces (1, 2, 16, 32, 128). If specified, the first character of the string is used instead of the usual space. For example, CVS($0000$+"XYZZY"+$0000$,2,$00$) strips trailing $00$ characters.

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).

128

Strip all spaces (*).

(*) If the optional char parameter was specified, use it instead of space.

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.

By default, the BBj CVS() function, like the original PRO/5 version, refers to the !CTYPE string to determine character types. If the JAVA_CVS !COMPAT setting is set to TRUE, BBj uses internal Java functions to determine if characters are uppercase, lowercase, digits, whitespace, or punctuation.

Examples

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

See Also

CVS() Function - String Data Conversion

Functions - Alphabetical Listing

 



______________________________________________________________________________________

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