2016-02-24

VBA - Get a string reversed

' 1. fun_String_Reverse
Public Function fStringReverse(InputString As String) As String

    ' Declare
    Dim lLen As Long, lCtr As Long
    Dim sChar As String
    Dim sAns As String
   
    ' Process
    lLen = Len(InputString)
    For lCtr = lLen To 1 Step -1
        sChar = Mid(InputString, lCtr, 1)
        sAns = sAns & sChar
    Next
   
    ' Return
    fStringReverse = sAns

End Function

No comments:

Post a Comment