VBA/Excel/Access/Word/String Functions/StrComp

Материал из VB Эксперт
Перейти к: навигация, поиск

StrComp() Returns the result of comparing two strings.

   <source lang="vb">

Sub strDemo13()

  Debug.Print StrComp("B", "C", vbTextCompare)

End Sub

</source>
   
  


Using the StrComp Function to Compare Apples to Apples

   <source lang="vb">

"StrComp(string1, string2 [, compare])(vbTextCompare) or binary comparison (vbBinaryCompare). Sub strDemo()

   Dim Pet As String
   Pet = "dog"
   If StrComp(Pet, "dog", vbTextCompare) = True Then _
       MsgBox "We do not accept dogs."

End Sub

</source>