by Kelly Ethridge (3 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 12th May 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Reverse a string quickly and efficiently.
Dim idx As Long
Dim ByteArray() As Byte
Dim tmpByte As Byte
Dim MAX As Long
ByteArray = StrConv(YourString, vbFromUnicode)
MAX = Len(YourString) - 1
For idx = 0 To MAX \ 2
tmpByte = ByteArray(idx)
ByteArray(idx) = ByteArray(MAX - idx)
ByteArray(MAX - idx) = tmpByte
Next idx
ReverseString = StrConv(ByteArray, vbUnicode)
End Function