CodeItBetter Programming Another VB Programming Blog

Compare two strings (case insensitive)

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'String Manipulation - Compare two strings (case insensitive)
Dim strString1 As String, strString2 As String
strString1 = "Abc"
strString2 = "abc"
If LCase$(strString1) = LCase$(strString2) Then
    MsgBox "Same value"
Else
    MsgBox "Not the same value"
End If
 
'Or

Dim strString1 As String, strString2 As String
strString1 = "Abc"
strString2 = "abc"
If StrComp(strString1, strString2, vbTextCompare) = 0 Then
    MsgBox "Same value"
Else
    MsgBox "Not the same value"
End If
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.