RB does have Xor and Xand.  Look at the Bitwise class.

Tom Benson wrote:

Hello -

I came across some code for visual basic that I wanted to try to port to Rb for my personal use, however there are a few lines that go beyond my knowledge
of what they do and why also how to make it work in Rb.

Here are the lines. Could some help me with this ?


Text2.Text = (Mid(Text1.Text, 1, 4) - &H69) Xor &H69 // HUH??? Rb doesn't like this. I get the mid( ) but not the rest


The values that start with & are hex values. Your problem is most likely the Xor boolean logic keyword, which I don't believe RB supports.

XOR is short for Exclusive Or. It is a value matching operand, rather than a value comparator if that makes sense.

basically

XOR (different = true, same = false)

Therefore:

XOR works like AND, except where both values are false, eg;

value 1 = false
value2 = false

if value1 AND value2 then result = false (one or both values are false)
if value1 XOR value2 then return = true (both values are the same)

You may need to implement your own XOR function as follows:

Function XOR(v1 as boolean, v2 as boolean) as boolean

    return v1 = v2

End Function


and

Text2.Text = Format(Hex(Text2.Text), "00") // Rb doesn't like this either.


This is a simple matter of RB not being able to format string values (Hex returns a string value). And since RB's Hex function seems to return a 2 character Hex value for the passed string anyway (which is what this formatter statement appears to do), this line is probably not needed.


Thanks

Eric


NW,

Tom

_______________________________________________
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>


All questions and answers unless otherwise stated are in Relation to Mac OS X 10.4 and later.


_______________________________________________
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>



_______________________________________________
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>

Reply via email to