Cvn Functions

Purpose

Convert part of string to an integer.

Syntax

byte = Cv1(s$ [,offset% = 1])

short = Cv2(s$ [,offset% = 1])

long = Cv3(s$ [,offset% = 1])

long = Cv4(s$ [,offset% = 1])

large = Cv5(s$ [,offset% = 1])

large = Cv6(s$ [,offset% = 1])

large = Cv7(s$ [,offset% = 1])

large = Cv8(s$ [,offset% = 1])

Description

Cv1 converts one character form s$ into a byte. Cv2 converts 2 characters, Cv3 three characters, and so on. The offset parameter specifies the position within the string to use for converting. The default is 1, which is the start of the string.

The data type of the variable that holds the return value must be large enough to hold the value.

Example

Print Cv1("Hello GFA")    // Prints 72, 72 is the ASCII code of H

Print Cv2("Hello GFA")    // Prints 25928

Print Cv3("Hello GFA")    // Prints 7103816

Print Cv4("Hello GFA")    // Prints 18190443144

Print Cv5("Hello GFA")    // Prints 47856041300

Print Cv6("Hello GFA")    // Prints 35662932501832

Print Cv7("Hello GFA")    // Prints 20020386278958408

Print Cv8("Hello GFA, 2") // Prints 5064051968933913928

Remarks

Other functions convert (part of) a string to Currency (CvCur), Double (Cvd), Single (Cvs), Int32 (Cvi), and Word (Cvw).

The reverse of the Cvn functions are the Mkn functions (Mk1Mk8)

See Also

Mkn Functions

{Created by Sjouke Hamstra; Last updated: 27/09/2014 by James Gaite}