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

Examples

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

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

Related VBScript commands

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


 
Copyright © 1999-2024 SS64.com
Some rights reserved