views:

48

answers:

1

I am trying to grok the following piece of code:

Mid$(strV, i, 1) = Chr$(intChar And &HDF)

What does &HDF mean? I also have a similar section that uses @H20. I have Googled high and low and the most I found was nothing that I didn't already know about them...that they are constants.

+1  A: 

That Visual Basic's hex notation. In C/C++/Java/C#, &HDF would be written as 0xDF.

Specifically, in your example, &HDF is 1101 1111 in binary. If a number in the range 0-255 (i.e., 0x00 - 0xFF) is ANDed with 0xDF, the 0x20 bit is set to zero. If that number happened to be in the range 97 - 122 (i.e. 'a' - 'z' in ASCII), it has the effect of converting it to the range 65 - 90 ('A' - 'Z' in ASCII)

James Curran
In other words, it's probably a really cryptic way to convert a specific lowercase letter to an uppercase letter within another string. I would probably have used the UCase and LCase functions, but they may have some other function we aren't seeing.
KevenDenen
Well, it is very fast --- if you can guarantee that the only characters it sees are letters. Digits and punctuation reak havoc with it (a space becomes `Chr$(0)`)
James Curran