String.contains method in vb.net

String.contains method 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