TypeName Function

Tips >>ASP Functions

The TypeName function returns the subtype of a specified variable.

The TypeName function has the following Return Values :-

Value Description
Byte Byte Value
Integer Integer Value
Long Long integer value
Single Single-precision floating-point value
Double Double-precision floating-point value
Currency Currency value
Decimal Decimal value
Date Date or Time value
String Character string value
Boolean Boolean value; True or False
Empty Uninitialized
Null No valid data
<object type> Actual type name of an object
Object Generic object
Unknown Unknown object type
Nothing Object variable that doesn't yet refer to an object instance
Error Error

The Syntax of the TypeName function is :-

TypeName(varname)

Its Description is :-

Parameter Description
varname Required. A variable name

Example#1 :-

Code :-
dim x
x="Hello World!"
document.write(TypeName(x) & "<br />")
x=4
document.write(TypeName(x) & "<br />")
x=4.675
document.write(TypeName(x) & "<br />")
x=Null
document.write(TypeName(x) & "<br />")
x=Empty
document.write(TypeName(x) & "<br />")
x=True
document.write(TypeName(x))
Output :-

String
Integer
Double
Null
Empty
Boolean

Example#2 :-

Code :-
Dim ArrayVar(4), MyType
NullVar = Null
MyType = TypeName("VBScript")
MyType = TypeName(4)
MyType = TypeName(37.50)
MyType = TypeName(NullVar)
MyType = TypeName(ArrayVar)
Output :-
Null
String
Integer
Double
Null
Variant

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641