VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Reverse a string quickly and efficiently.

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.

Rate 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

Download this snippet    Add to My Saved Code

Reverse a string quickly and efficiently. Comments

No comments have been posted about Reverse a string quickly and efficiently.. Why not be the first to post a comment about Reverse a string quickly and efficiently..

Post your comment

Subject:
Message:
0/1000 characters