VBScript StrComp Function
-- Learn not just technology, but also dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
- VB Tutorial
- VB Usage
- VB Variables
- VB Procedures
- VB Conditionals
- VB Looping
- VB Summary
- VB Examples
- VB Functions
- VB Keywords
VBScript StrComp Function
Complete VBScript Reference Manual
StrComp function compares two strings and returns a value representing the comparison result.
StrComp function can return the following values:
- -1 (if string1 < string2)
- 0 (if string1 = string2)
- 1 (if string1 > string2)
- Null (if string1 or string2 is Null)
Syntax
StrComp(string1,string2[,compare])
| Parameter | Description |
|---|---|
| string1 | Required. A string expression. |
| string2 | Required. A string expression. |
| compare | Optional. Specifies the type of string comparison to use. Default is 0. Can be one of the following values:
|
Example 1
document.write(StrComp("VBScript","VBScript"))
Output:
0
Example 2
document.write(StrComp("VBScript","vbscript"))
Output:
-1
Example 3
document.write(StrComp("VBScript","vbscript",1))
Output:
0
YouTip