StrComp Function

Syntax

Number StrComp(String stringA, String stringB, Number compareOption = 0, Number maxChars = -1)

Return Value

Number

A number less than 0 if the first string is less than the second. A number greater than 0 if the first string is greater than the second. 0 if the strings are equal.

Purpose

This function compares two strings.

Parameters

stringA as String

The first string to compare.

stringB as String

The second string to compare.

compareOption as Number

An optional number that specifies how to compare the strings. Pass 0 for a case-sensitive comparison (this is the default). Pass 1 for a case-insensitive comparison.

maxChars as Number

An optional number that specifies the maximum number of characters to compare. Pass -1 to compare all characters (this is the default).