VBScript StrComp- functie


❮Volledige VBScript-referentie

De functie StrComp vergelijkt twee tekenreeksen en retourneert een waarde die het resultaat van de vergelijking vertegenwoordigt.

De StrComp-functie kan een van de volgende waarden retourneren:

  • -1 (indien string1 < string2)
  • 0 (als string1 = string2)
  • 1 (indien string1 > string2)
  • Null (als string1 of string2 Null is)

Syntaxis

StrComp(string1,string2[,compare])

Parameter Description
string1 Required. A string expression
string2 Required. A string expression
compare Optional. Specifies the string comparison to use. Default is 0

Can have one of the following values:

  • 0 = vbBinaryCompare - Perform a binary comparison
  • 1 = vbTextCompare - Perform a textual comparison

voorbeeld 1

response.write(StrComp("VBScript","VBScript"))

Output:

0

Voorbeeld 2

response.write(StrComp("VBScript","vbscript"))

Output:

-1

Voorbeeld 3

response.write(StrComp("VBScript","vbscript",1))

Output:

0

❮Volledige VBScript-referentie