views:

294

answers:

1

I have the following C++ code:

Char ^= 0xB3;

Char is a single character in a string. Is there an equivalent in VBScript?

+3  A: 

Char = chr(asc(Char) xor &HB3)

moonshadow
I get:Type mismatch: 'ord'
David Brown
That's Asc, not Ord.
PhiLho
Geh, wrong flavour of Basic. Fixed.
moonshadow
It definitely looks like it should work, but it's not returning the same result as the C++ code. Every letter of the original string ends up being the exactly the same.
David Brown
How are you passing each character of the string in? Asc() takes a string argument and returns the ANSI code of the first character.
mercator
I do a For loop from 1 to the length of the string, using Mid(theString, i, 1) to get the character at the current position in the loop, then concatenating the result of the above transformation onto a new string.
David Brown