CVI()
This page was last modified 19:45, 13 January 2022 by Pgimeno. Based on work by Mars2000you and Josb and others.

Contents

Effect

Returns the integer that corresponds to the 2-byte value stored in the given 2 character string, in little endian order.

Notes:

  • Roughly equivalent to: CVI(D$)=ASC(MID$(D$,2))*256+ASC(D$) however CVI returns an integer, and therefore it returns negative values when the second character of D$ is greater than CHR$(127).
  • The function that performs the opposite conversion is MKI$(), which takes an integer and returns a 2-byte string.

Syntax

CVI(<StringExpression>)

Parameter

<StringExpression> is a 2-character long string expression or variable.

Example

D$="12": D=CVI(D$): PRINT D
 12849

Related to

CVD(), CVS(), LSET, MKD$(), MKI$(), MKS$(), RSET, VARPTR()

Compatibility

Disk BASIC 1.0 or higher / both modes of Nextor OS