Dim str1, str2 As String
Dim i As Int
str1 = "abcdef"
For i = str1.Length - 1 To 0 Step -1
str2 = str2 & str1.CharAt(i)
Next
Msgbox(str1 & CRLF & str2, "Reversed")
I know it's old, but I was looking for this but the sub above appeared unoptimized so I made one
B4X:
Sub StrReverse(Text As String) As String
Dim tempstr As StringBuilder,temp As Int
tempstr.Initialize
For temp = Text.Length-1 To 0 Step -1
tempstr.Append( Text.CharAt(temp) )
Next
Return tempstr.ToString
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.