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