BOOL ChrCmpI( TCHAR c1, TCHAR c2);
Declare Function ChrCmpI Lib "shlwapi" Alias "ChrCmpIA" ( _ ByVal c1 As Byte, ByVal c2 As Byte) As Long
引数の意味は以下の通り。
| c1 | 比較元文字。 |
| c2 | 比較先文字。 |
c1とc2が同一の文字の場合、0が返される。異なる文字の場合、0以外が返される。
Declare Function ChrCmpI Lib "shlwapi" Alias "ChrCmpIA" (ByVal c1 As Byte, ByVal c2 As Byte) As Long
Private Sub Command1_Click()
Dim S1 As String
Dim S2 As String
S1 = "A"
S2 = "a"
If ChrCmpI(AscB(S1), AscB(S2)) = 0 Then
MsgBox S1 & "と" & S2 & "は同じ文字"
Else
MsgBox S1 & "と" & S2 & "は違う文字"
End If
End Sub