StrComp

Compare two strings.

Syntax 
      StrComp(String1, String2 [,compare] )

Key
   String1   A string expression.

   String2   A string expression.

   compare   vbBinaryCompare (0) or vbTextCompare(1)

If string1 = string2 StrComp returns 0 (vbFalse)
If string1 < string2 StrComp returns -1 (vbTrue)
If string1 > string2 StrComp returns 1
If either string = null StrComp returns null

Example

strPerson ="Hilary"
result = StrComp("Hilary", strPerson)
WScript.Echo result

“If you want to marry wisely, marry your equal” ~ Spanish Proverb

Related:

Replace - Find and replace text
Equivalent Powershell command: [String]::Compare or the CompareTo method or comparison operators.


© Copyright SS64.com 1999-2013
Some rights reserved