Re: Val() versus CLng, CInt or CByte




"Donald Lessau" <don@xxxxxxxxx> wrote in message
news:fg7bfa$iq1$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx

"dpb" <none@xxxxxxx> schrieb im Newsbeitrag news:fg7aiu$mf$1@xxxxxxxxxxx
Donald Lessau wrote:
"Steve Gerrard" <mynamehere@xxxxxxxxxxx> schrieb im Newsbeitrag
news:Q4ednZ36GKyrLLvanZ2dnUVZ_gWdnZ2d@xxxxxxxxxxxxxx

Val is nice because it it will read a number followed by text, i.e. 23A
becomes 23, instead of tossing up an error...

... which also has a dark side: e.g. Val("23E2") -> 2300, and
Val("23E-2") -> 0.23

What's the "dark" side of correct interpretation of a floating point
exponential notation??? (Puzzled as to why one would/could possibly
expect/want any other result...)

I referred to the statement of the previous poster:
Val is nice because it it will read a number followed by text...

If you use Val to grab numbers from the left end of strings (a quite common
usage of Val it seems to me), you might be surprised by the returns when the
string happens to look like an exponential notation.

Don

I tend to agree, Don, Val is often used that way, and I meant the word "nice" as
a polite way of saying "sloppy". I myself prefer to use explicit conversions,
with parsing if needed. There just aren't enough situations where I need to peel
a number from the left end of a string that I can't sort them out myself.


.



Relevant Pages

  • Re: Baghdad
    ... Yes, of course, string theory (but hey, spring theory ... but for me Goethe is more important than ... of rigorosity, ... hope and poetry and humming in a dark room. ...
    (sci.lang)
  • Re: Do you think?
    ... Lets write it on "Dark Matter" tablets. ... The only real theories to come along are the string and dark ...
    (talk.origins)
  • Re: Do you think?
    ... Lets write it on "Dark Matter" tablets. ... The only real theories to come along are the string and dark ...
    (talk.origins)
  • Large discounts for bulk orders - qdru
    ... Her dark, pretty face omulglittered there in front of me. ... A string somewhere I didn't see hooked on atpl that flowered red skirt and ... was tugging her back. ...
    (Debian-User)
  • Re: do I use fopen or fsockopen to get an image as a stream of bytes?
    ... >>Well, I'm groping in the dark here, but I think that ... >>imagecreatefromstring would give me an actual image, ... >>want is an actual string, and I don't know how to get a string from an ...
    (comp.lang.php)