Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

VBScript StrComp function


May 13, 2021 VBScript


Table of contents


VBScript StrComp function

The VBScript StrComp function returns a value that reflects the results of the string comparison.


VBScript StrComp function Complete VBScript reference manual

The StrComp function compares two strings and returns a value that represents the result of the comparison.

The StrComp function returns the following value:

  • -1 (if string1 slt; string2)
  • 0 (if string1 s string2)
  • 1 (if string1 and string2)
  • Null (if string1 or string2 is Null)

Grammar

StrComp(string1,string2[,compare])

parameter describe
string1 Required.String expressions.
string2 Required.String expressions.
compare Optional.The string comparison type to use is specified.The default is 0.

The following values can be used:

  • 0 = VBBINARYCOMPARE - Performing binary comparison
  • 1 = vbtextcompare - Perform text comparison

Instance 1

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

Output:

0

Instance 2

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

Output:

-1

Instance 3

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

Output:

0


VBScript StrComp function Complete VBScript reference manual