VBScript StrComp- funksie


❮ Voltooi VBScript-verwysing

Die StrComp-funksie vergelyk twee stringe en gee 'n waarde terug wat die resultaat van die vergelyking verteenwoordig.

Die StrComp-funksie kan een van die volgende waardes terugstuur:

  • -1 (as string1 < string2)
  • 0 (as string1 = string2)
  • 1 (as string1 > string2)
  • Nul (as string1 of string2 Nul is)

Sintaksis

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

❮ Voltooi VBScript-verwysing