VB Net – Reverse string order
Private Function Reverse(ByVal str As String) As String
If str.Length > 1 Then
Dim val As New System.Text.StringBuilder
For pos As Int32 = str.Length – 1 To 0 Step -1
val.Append(str.Chars(pos))
Next
Return val.ToString
Else
Return str
End If
End Function
Usage: Reverse(“i__h4x”), would give x4h__i
No comments yet
Leave a reply