|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Print Variable Data Type
=?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) Evertjan. wrote on 15 jun 2006 in microsoft.public.inetserver.asp.general:
Show quote > =?Utf-8?B?SmVzcw==?= wrote on 15 jun 2006 in And, not teasing you any more, vbscript has:> 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> > 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) 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) > |
|||||||||||||||||||||||