Print Variable Data Type

Discussion in 'ASP General' started by Jess, Jun 15, 2006.

  1. Jess

    Jess Guest

    Is there a way to print a variable's data type - like int, string, dbl?
    Jess, Jun 15, 2006
    #1
    1. Advertising

  2. Jess

    Evertjan. Guest

    =?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., Jun 15, 2006
    #2
    1. Advertising

  3. Jess

    Evertjan. Guest

    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)
    Evertjan., Jun 15, 2006
    #3
  4. Jess

    Jess Guest

    COOL! THanks

    "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)
    >
    Jess, Jun 15, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. luna
    Replies:
    1
    Views:
    6,816
  2. heyo
    Replies:
    3
    Views:
    903
    Dan Pop
    Apr 1, 2004
  3. pete
    Replies:
    4
    Views:
    794
    Dan Pop
    Apr 2, 2004
  4. keto
    Replies:
    0
    Views:
    927
  5. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    347
    David Cournapeau
    Dec 30, 2008
Loading...

Share This Page