Hi Hope I can get an answer here to a stupid question.
Stupid because it’s been explained to me & I still can’t get it right.
Python Code:
sqln = 13173942528351756918
sqlid = ''
alphabet = '0123456789abcdfghjkmnpqrstuvwxyz'
for i in range(0, 13):
sqlid = alphabet[(sqln / (32 ** i)) % 32] + sqlid
RESULT: bdntyxtax2smq
vb.net code:
Dim sqln As UInt64 = 13173942528351756918
Dim sqlid as string = ""
Dim alphabet as String = "0123456789abcdfghjkmnpqrstuvwxyz"
For iCount As Integer = 0 To 12
sqlid = alphabet((sqln / (32 ^ iCount)) Mod 32) + sqlid
Next iCount
RESULT: bfpuzytbx3s00
I suspect the reason the results are different is because vb.net returns a double when you call ^ and I should be “shifting” it but can’t seem to work out the syntax (or find it)
Thanks for your time =+ ideas =+ help
This time, you’re dividing by 32iCount which is equivalent to shifting right by
5 * iCount:Output:
It sounds like it would be a good idea to read up on bitwise operations 🙂