Visual Basic String Using StartsWith
In Visual Basic, we use the StartsWith() method to determine whether a string starts with the specified character(s). This method, which returns a bool value, has 3 different uses.
The most commonly used form is given in the example below..
Module ModuleTest Sub Main() Dim str As String = "El" Dim name As String() = New String() {"Elif", "Ahmed", "Ela", "Joe", "Mick", "Ali", "Elvin"} For Each i As String In name If i.StartsWith(str) Then Console.WriteLine(i) End If Next Console.ReadLine() End Sub End ModuleWe tried to understand whether the elements in our name array start with El. We scanned all the elements with the "Foreach" loop and used the "StartsWith()" method. We printed the results true to the screen.