Reverse a string in VB.NET
4
This function provides the reverse of a string. It is constructed using string builder because strings in .NET are immutable, while stringbuilders are not. Therefore large strings could be slow to reverse if a regular string was used for the working value that is returned.
'Provides the reverse of a passed in string
Private Function Reverse(ByVal value As String) As String
If value.Length > 1 Then
Dim workingValue As New System.Text.StringBuilder
For position As Int32 = value.Length - 1 To 0 Step -1
workingValue.Append(value.Chars(position))
Next
Return workingValue.ToString
Else
Return value
End If
End Function






str = "some string "
str = StrReverse(str)