VB net – How do I remove the first character from a string

 

VB Net – Code:
  1. Function RemoveFirst(ByVal myString As String)
  2. If myString <> String. Empty Then Return myString. Remove(0, 1) Else Return String. Empty.
  3. End Function.

Example : –

Dim s As String = “KNIP”
MessageBox.Show(s.Remove(0, 1))

 

Here 0 (zero) is the start index of string and 1 is the count of chars to remove.

“ijklm” is displayed as first 1 chars (K) were removed.

Leave a Reply

Your email address will not be published. Required fields are marked *