String.StartsWith : String « System « VB.Net by API






String.StartsWith

  
Imports System

Public Class MainClass

   Shared Sub Main()
      Dim strings As String()
      Dim i As Integer
      Dim quotes As Char = ChrW(34)

      strings = New String() {"started", "starting", _
         "ended", "ending"}

      Console.WriteLine(" test every string to see if it starts with 'st'")
      For i = 0 To strings.GetUpperBound(0)

         If strings(i).StartsWith("st") Then
            Console.WriteLine(quotes & strings(i) & quotes & _
               " starts with " & quotes & "st" & quotes )
         End If

      Next

      Console.WriteLine(" test every string to see if it ends with 'ed'")
      For i = 0 To strings.GetUpperBound(0)

         If strings(i).EndsWith("ed") Then
            Console.WriteLine( quotes & strings(i) & quotes & _
               " ends with " & quotes & "ed" & quotes )
         End If

      Next
   End Sub ' Main

End Class

   
    
  








Related examples in the same category

1.String.Compare
2.String.Concat
3.String.Copy
4.String.Empty
5.String.Equals
6.String.Format
7.String.GetEnumerator
8.String.GetHashCode()
9.String.IndexOf(String substring)
10.String.IndexOfAny(String sub)
11.String.IndexOfAny(String sub, Int count)
12.String.Insert
13.String.IsNullOrEmpty
14.String.LastIndexOf
15.String.PadLeft(Int length)
16.String.PadLeft(Int length, String char)
17.String.Replace
18.String.Split
19.String.Substring(Int begin)
20.String.Substring(Int begin, Int end)
21.String.ToCharArray()
22.String.ToLower()
23.String.ToUpper()