IT KNOWLEDGE

IT KNOWLEDGE
BC

Wednesday, May 21, 2014

Compare Two Strings (VB.Net)

I will use two strings with difference character case to compare with each others as shown below:

  1. String1 = "I LIke Vb pRoGrame"
  2. String1 = "I Like VB Programe"

So this sample will show if these two string are the same or not. We use one Button with Click_Event then pop up the message with condition below.

                         Dim String1 As String = "I LIke Vb pRoGrame"
                         Dim String2 As String = "I Like VB Programe"
                         If String.Compare(String1, String2, True) = 0 Then
                                MsgBox("Strings Match")
                         Else
                                MsgBox("Strings do not Match")
                         End If


  • As you see the result, although these two strings are difference Character Case but they are the same words.


Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: itech-9999

0 comments: