Pages

Showing posts with label Reverse. Show all posts
Showing posts with label Reverse. Show all posts

Sunday, April 20, 2008

REVERSE String

There were couple of mails around in simple way how to reverse a string....

Public Function ReverseString(ByVal InputString As String) _
As String

Dim lLen As Long, lCtr As Long
Dim sChar As String
Dim sAns As String

lLen = Len(InputString)
For lCtr = lLen To 1 Step -1
sChar = Mid(InputString, lCtr, 1)
sAns = sAns & sChar
Next

ReverseString = sAns

End Function