Mega Code Archive

 
Categories / VB.Net Tutorial / Data Type
 

Reverse a string

public class Test    public Shared Sub Main         Dim objTS As TimeSpan         Dim dteStart As Date         Dim strText As String         Dim strChar As String         Dim intChar As Integer         dteStart = Now()         strText = "12345678"         Dim intLen As Integer = Len(strText)         For intChar = 1 To CInt(intLen / 2)             strChar = Mid(strText, intChar, 1)             Mid(strText, intChar, 1) = Mid(strText, intLen - intChar - 1, 1)             Mid(strText, intLen - intChar - 1) = strChar         Next         objTS = Now().Subtract(dteStart)         Console.WriteLine(objTS.ToString)         Console.WriteLine(strText)    End Sub     End class 00:00:00 65342178