How to find that substring is exist within string or not in vb.net

Contains method of the string class determine that the substring is present inthe string or not, or we can say contains method checks whether specified parameter string exist inthe string or not. this method returns boolean type value true and false.

Method:
Public function Contains(byval Value as string) as boolean

Parameters:
value: The System.String object to seek.

Return Values:
true if the value parameter occurs within this string, or if value is the empty string (“”); otherwise, false.

Example:

  Dim str As String = "Welcome to my home" 
  Dim isExist As Boolean = str.Contains("come") 
  If isExist Then 
     MessageBox.Show("found") 
  Else 
     MessageBox.Show("not found") 
  End If

One thought on “How to find that substring is exist within string or not in vb.net”

  1. when we find 1 September in 11 September condition become true ..give me other way…

Comments are closed.