System Functions

CVS( )

Convert String



Reformat String:



Return Accent Table:

CVS( * )


Return Character String:

CVS(num_val, num_val, num_val, ... )    (Added in PxPlus v7.00)



(asterisk) Returns the current 256-byte accent translation table.


Optional control character. String expression. Default: blank character.


Conversion type. Numeric expression. See the table in Format 1.


Data to convert. String expression.


Numeric values of the characters to be converted into a string.


Program line number or statement label to which to transfer control.


Converted value of string expression or accent translation table.

Format 1

The CVS( ) function converts a string of data to different forms based on the numeric values used for cvs_code (e.g. to convert to uppercase, stripped string, etc.). The numeric expression tells the function the type of conversion to perform. If you append a : (colon) and string value, the control character used in the conversion will be the first character of the string; otherwise, it will be a space.

You can also use the function to return the current accent translation table and do translations based on it. See DEF CVS/DTE/LCS/UCS directives.

The value of cvs_code is made up of a series of binary values indicating:


Conversion to Take Place


Strip leading control characters.


Strip trailing control characters.


Convert string to uppercase.


Convert string to lowercase.


Replace non-printable characters with the control character.


Replace multiple occurrences of the character with one.


Replace $ with a defined currency symbol, comma with a defined thousands separator, and period with a defined decimal point. See the following system parameters:

'CU'= Currency Symbol
'DP'= Decimal Point Symbol
'TH'= Thousands Separator


Replace a defined currency symbol, thousands separator and decimal point with $, comma, and period respectively (inverse of value 64 above).


Convert string to mixed case (first letter of each word is uppercase, the rest of the letters are lowercase).


Translate the string expression provided in data$ based on the current accent translation table.

See Also

STP( ) Strip Leading/Trailing Characters
LCS( ) Return Lowercase String
UCS( ) Return Uppercase String


print "|",cvs(" The Cat ",1:" "),"|"

yields |The Cat|

print "|",cvs(" The Cat ",2:" "),"|"

yields |The Cat|

print "|",cvs(" The Cat ",39),"|"

yields |THE CAT|

32+4+2+1=39 (you can use a sum)

print cvs("$$$123",32:"$")

yields $123

Format 2

The CVS( * ) format returns a 256-byte string consisting of the character mapping table used for accented characters. Each byte in the table represents the character that the system uses when applying the accented character mapping for keyed files.


If the character is found in the text, its binary value (194 - Hex $C2$) will be used as the offset into the mapping table. For purposes of computing the offset, the first character in the table is considered offset 0, the second offset 1, and so on; therefore, an will be substituted with the character at position 195 in the string.

Format 3

The CVS( ) function can also be used to return a character string based on a series of numeric values. When using Format 3, each numeric value passed is considered to be the binary UNICODE value for each character in the string to be returned.


The value of cvs(77,105,107,101) will return the string "Mike" since the binary value of "M" is 77, "i" is 105, etc.:

cvs(77,105,107,101) = chr(77)+chr(105)+chr(107)+chr(101)

The primary purpose of this function is to provide for the easy conversion of UNICODE data into UTF-8.

(The CVS extension to provide UNICODE values was added in PxPlus v7.00.)