Home All Groups Group Topic Archive Search About

Print Variable Data Type



Author
15 Jun 2006 7:39 PM
Jess
Is there a way to print a variable's data type - like int, string, dbl?

Author
15 Jun 2006 7:48 PM
Evertjan.
=?Utf-8?B?SmVzcw==?= wrote on 15 jun 2006 in
microsoft.public.inetserver.asp.general:

> Is there a way to print a variable's data type - like int, string, dbl?


<script language='javascript' runat='server'>

var myVarable = 2

response.write(typeof myVarable);

</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Author
15 Jun 2006 7:52 PM
Evertjan.
Evertjan. wrote on 15 jun 2006 in microsoft.public.inetserver.asp.general:

Show quote
> =?Utf-8?B?SmVzcw==?= wrote on 15 jun 2006 in
> microsoft.public.inetserver.asp.general:
>
>> Is there a way to print a variable's data type - like int, string, dbl?
>
>
> <script language='javascript' runat='server'>
>
> var myVarable = 2
>
> response.write(typeof myVarable);
>
> </script>
>

And, not teasing you any more, vbscript has:

Dim ArrayVar(4), MyType
NullVar = Null   ' Assign Null value.

MyType = TypeName("VBScript")   ' Returns "String".
MyType = TypeName(4)            ' Returns "Integer".
MyType = TypeName(37.50)        ' Returns "Double".
MyType = TypeName(NullVar)      ' Returns "Null".
MyType = TypeName(ArrayVar)     ' Returns "Variant()".


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Author
15 Jun 2006 8:14 PM
Jess
COOL!  THanks

Show quote
"Evertjan." wrote:

> Evertjan. wrote on 15 jun 2006 in microsoft.public.inetserver.asp.general:
>
> > =?Utf-8?B?SmVzcw==?= wrote on 15 jun 2006 in
> > microsoft.public.inetserver.asp.general:
> >
> >> Is there a way to print a variable's data type - like int, string, dbl?
> >
> >
> > <script language='javascript' runat='server'>
> >
> > var myVarable = 2
> >
> > response.write(typeof myVarable);
> >
> > </script>
> >
>
> And, not teasing you any more, vbscript has:
>
> Dim ArrayVar(4), MyType
> NullVar = Null   ' Assign Null value.
>
> MyType = TypeName("VBScript")   ' Returns "String".
> MyType = TypeName(4)            ' Returns "Integer".
> MyType = TypeName(37.50)        ' Returns "Double".
> MyType = TypeName(NullVar)      ' Returns "Null".
> MyType = TypeName(ArrayVar)     ' Returns "Variant()".
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>

AddThis Social Bookmark Button