String Comparison Operation

This section provides a quick introduction of string comparison operations, which compare one character at a time based its ASCII value.

String comparison operations are operations that:

There are 6 string comparison operations supported in VBScript:

To show you how string operations work, I wrote the following script, string_comparison.html:

<!-- string_comparison.html
 - Copyright (c) 1998 All Rights Reserved.
<script language="vbscript">
   document.writeln("ABC" = "abc")
   document.writeln("ABC" <> "abc")
   document.writeln("abc " > "abc")
   document.writeln("abc" < "abc")
   document.writeln("abc" >= "abd")
   document.writeln("abc" <= "abc")

Here is the output of this VBScript example script:


The output confirms some of string comparison operation rules:

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

String Operations - Concatenation and Comparison

 String Concatenation Operation

String Comparison Operation

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)


 Full Version in PDF/EPUB