Val() function in ASP

Results 1 to 2 of 2

Thread: Val() function in ASP

  1. #1
    Join Date
    Dec 1969

    Default Val() function in ASP

    Why doesn&#039t the val() function work in ASP? I need to convert a hexadecimal (such as &H14214FF&) to a long integer) Does anybody know of another way to do this?<BR><BR>Thanks, <BR><BR>Joe

  2. #2
    Join Date
    Dec 1969

    Default RE: Val() function in ASP

    You don&#039t need it in ASP because *every* value in ASP is *actually* a Variant and is automatically convertible to every other valid type.<BR><BR>So <BR><BR>x = &H14214FF<BR><BR>and x is *already* a long integer. But it&#039s also a string. And can even be forced to be a date (welll...with uninteresting results).<BR><BR>Generally, you can force conversions with CDbl, CLng, CInt, CStr, CDate, etc. But you seldom really need to.<BR><BR>Oh...and yes, you *can* convert a hex STRING to a number even, the same way!<BR><BR>hnum = "&h"<BR>hnum = hnum & "FF" <BR>etc.<BR><BR>And then simply *use* that as if it is a number...and it will be!<BR><BR>array(hnum)<BR><BR>But if you are worried about it, you can always do<BR><BR>array( CLng( hnum ) )<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts