str="I'm QuickTestProfessionall.Do you know me?"
arrStrings = Split(str,space(1))
msgbox ubound(arrStrings)
vstrReverse=empty
For each arrStr in arrStrings
vstrReverse = strReverse(arrStr) & space(1) & vstrReverse
msgbox arrStr'each string separated by a single space
Next
msgbox vstrReverse
or
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
No comments:
Post a Comment