Reputation: 111
I have some data that I am scraping from a local device on my LAN. It uses javascript to format the data, but I need to perform the same formatting in VB.net. Here is an abbreviated version of the javascript:
var n = 0x740900;
alert(((n >>> 8) & 0xFF) + 1);
//result is 10
n = 0x740a00;
alert(((n >>> 8) & 0xFF) + 1);
//result is 11
Essentially, I need to feed a variable (n in this case) into the calculation, and then I am returned a value.
From my research, the >>> is a zero-fill right shift operator. I've been trying to replicate it in VB.net, but the >>> operator isn't available.
Any ideas how I can replicate this in VB.net?
Upvotes: 0
Views: 43
Reputation: 5403
Dim n As UInteger = &H740900
Console.WriteLine(((n >> 8) And &HFF) + 1)
'result is 10
n = &H740A00
Console.WriteLine(((n >> 8) And &HFF) + 1)
Console.ReadKey()
'result is 11
Upvotes: 3