Why isnumeric return true?

Discussion in 'ASP General' started by Lasse Edsvik, Oct 5, 2004.

  1. Lasse Edsvik

    Lasse Edsvik Guest

    Hello

    one question........ why does isnumeric return true?

    a=""
    if isnumeric(a) then
    response.write("test")
    end if

    empty isnt numerical is it??
    TIA
    /Lasse
    Lasse Edsvik, Oct 5, 2004
    #1
    1. Advertising

  2. Because, the numeric equivalent of a empty string is a numeric zero (not a
    string "0").

    Historial perspective:
    If you know C programming language, the string is always terminated by a
    numeric zero (not a string zero). That way, the runtime knows where the
    string ends -- since the string is essentially a space in memory.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Lasse Edsvik" <> wrote in message
    news:...
    > Hello
    >
    > one question........ why does isnumeric return true?
    >
    > a=""
    > if isnumeric(a) then
    > response.write("test")
    > end if
    >
    > empty isnt numerical is it??
    > TIA
    > /Lasse
    >
    >
    Manohar Kamath, Oct 5, 2004
    #2
    1. Advertising

  3. What version of the Windows Scripting Host do you have installed? That does
    not return true for me with version 5.6.

    Also, IsNumeric is less than perfect, unfortunately. Check out the caveats
    here. (Halfway down the page at the VBScript/Javascript section)
    http://www.aspfaq.com/show.asp?id=2390

    Ray at work


    "Lasse Edsvik" <> wrote in message
    news:...
    > Hello
    >
    > one question........ why does isnumeric return true?
    >
    > a=""
    > if isnumeric(a) then
    > response.write("test")
    > end if
    >
    > empty isnt numerical is it??
    > TIA
    > /Lasse
    >
    >
    Ray Costanzo [MVP], Oct 5, 2004
    #3
  4. Lasse Edsvik

    David Morgan Guest

    Yes, you're better off checking the string is only made up of 0 - 9 as
    ABCDEF are numeric also.

    E.G. 5F

    Regards

    David
    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:ucq7O%...
    > What version of the Windows Scripting Host do you have installed? That

    does
    > not return true for me with version 5.6.
    >
    > Also, IsNumeric is less than perfect, unfortunately. Check out the

    caveats
    > here. (Halfway down the page at the VBScript/Javascript section)
    > http://www.aspfaq.com/show.asp?id=2390
    >
    > Ray at work
    >
    >
    > "Lasse Edsvik" <> wrote in message
    > news:...
    > > Hello
    > >
    > > one question........ why does isnumeric return true?
    > >
    > > a=""
    > > if isnumeric(a) then
    > > response.write("test")
    > > end if
    > >
    > > empty isnt numerical is it??
    > > TIA
    > > /Lasse
    > >
    > >

    >
    >
    David Morgan, Oct 7, 2004
    #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. Siemel Naran

    Does true ^ true return false?

    Siemel Naran, Jun 17, 2004, in forum: C++
    Replies:
    19
    Views:
    643
    Chris Theis
    Jun 18, 2004
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    838
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,671
    Smokey Grindel
    Dec 2, 2006
  4. bdb112
    Replies:
    45
    Views:
    1,296
    jazbees
    Apr 29, 2009
  5. w i l l
    Replies:
    4
    Views:
    226
    Dan Brussee
    Jul 4, 2003
Loading...

Share This Page