Classic ASP Conversion Functions

Conversion functions allow you to change the subtype of a variable. VBScript assigns the variant type to all variables as a default, but there are many cases when you might have to convert a variable to a particular type to satisfy an arguement. A common example would be that you might have a string arguement that returns a numeric value or a numeric arguement that returns a string value. Here are some of the most commonly used conversion functions:

CByte:
The CByte function converts this variable to a subtype byte.

CByte(strExample)

CDbl:
The CDbl function converts this variable to a subtype double.

CDbl(strExample)

CInt:
The CInt function converts this variable to a subtype integer.

CInt(strExample)

CLng:
The CLng function converts this variable to a subtype long.

CLng(strExample)

CStr:
The CStr function converts this variable to a subtype string.

CStr(strExample)

Bookmark

Advertisement