On May 8, 2006, at 8:26 AM, Emile Schwarz wrote:
I do not really understand what I read in the Language Reference,
Val Function entry:
<quote>
Val Function
Returns the numeric form of a String.
<some text snipped>
That is, " &hFF" returns 0, but "&h FF" returns 255.
</quote>
Here's what I do not understand:
<That is, " &hFF" returns 0, but "&h FF" returns 255.>
Why ?
Very simple. You cannot have a space or spaces in a Val Function
string immediately before &h, &c or &b. It reacts the same as Val(" ")
[space].
For example, " 34 Items" works but " ", " &h, etc all evaluate
to a non numeric character and result in a zero result.
The OLR examples in 2005 and 2006 have a text copying error in the
last two example lines of the first set. They have an added space
before the ampersand. I have noticed spacing errors in many of the
other OLR items in the new html OLR. I think it might have been
caused by scanning errors.
The feedback report is:
-----------
<http://www.realsoftware.com/feedback/viewreport.php?reportid=xkozqbfa>
The example in the Online Language Reference shows a space before the
Ampersands below which will return a result of 0 in both cases.
2005/6 OLR
n = Val("' &hFFF") //returns 4095
n = Val(" &b1111") //returns 15
2005/6 PDF versions and the 5.5.5 OLR are correct.
n = Val("&HFFF") //returns 4095
n = Val("&b1111") //returns 15
-----------
A quick test is to place a space before the &cFFFFFF background color
of a window. It will immediately be set to Black (&c000000) on a return.
Terry
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>