:
This message was edited by lionb at 2005-12-8 13:11:31
: : Is there a syntax that reverses things?
: : Example: 123 int 321
: :
: There is always some syntax around ... if you willing to think a little bit

:
: Private Sub Command1_Click()
: Dim i As Integer
: Dim sOld As String, sReverse As String
:
: sOld = "123"
:
: For i = Len(sOld) To 0 Step -1
: If i > 0 Then
: sReverse = sReverse & Mid(sOld, i, 1)
: End If
: Next
: Text1 = sReverse
: End Sub
:
:
:
:
This one works much faster:
Private Function Mod_sReverse(ByRef sOriginal As String) As String
Dim lIndex As Long
Dim lLen As Long
Dim sReverse As String
lLen = Len(sOriginal)
'''Preallocate string
sReverse = sOriginal
For lIndex = 1 To lLen
'''move each character
Mid$(sReverse, (lLen - lIndex + 1), 1) = Mid(sOriginal, lIndex, 1)
Next lIndex
Mod_sReverse = sReverse
End Function
Mike