Reverse a String

This function returns a string reversed according to the parameter "strToReverse".


''' <summary>
''' Reverses a string.
''' </summary>
''' <param name="strToReverse">The string you'd like to reverse.</param>
''' <returns>The string value of the reversed string.</returns>
''' <remarks></remarks>

Public Function ReverseString(ByRef strToReverse As String) As String
    Dim result As String = ""
    For i As Integer = 0 To strToReverse.Length - 1
        result += strToReverse(strToReverse.Length - 1 - i)
    Return result
End Function

' Example Usage
MessageBox.Show(ReverseString("Hello World!"))

See Also

</DIC> Submission -

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License