Mega Code Archive

 
Categories / VB.Net Tutorial / Data Type
 

Converts a substring within a string to an array of characters, then enumerates and displays the elements of the array

' Sample  for String.ToCharArray(Int32, Int32) Imports System Class Sample    Public Shared Sub Main()       Dim str As String = "012wxyz789"       Dim arr() As Char       arr = str.ToCharArray(3, 4)       Console.Write("The letters in '{0}' are: '", str)       Console.Write(arr)       Console.WriteLine("Each letter in '{0}' is:", str)       Dim c As Char       For Each c In arr          Console.WriteLine(c)       Next c    End Sub End Class