Compare

Description

This function is used to compare two strings; if the strings are identical, compare will return 1 (true). If not, compare returns 0 (false). By default, the comparison is case-sensitive.

Syntax

 
int compareStrings = Compare(string str1$, string str2$ [, int Case]);

Arguments

str1,str2

are the strings you want to compare.

Case [optional]

specifies the case sensitivity. Case = 1 (true) makes the compare case sensitive, Case = 0 (false) does not match case. The default value is 1 (true).

Return

If the strings are identical, return 1 (true).

If the strings are not identical, return 0 (false).

Example

string str1$ = "ABC";
string str2$ = "abc";

// The optional argument CaseSensitivity is omitted; 
//the compare will be case sensitive.
int compareAbc = compare(str1$,str2$);
compareAbc=; // Will return 0 since the strings do not match case.

int case2 = 0; // Turn off case sensitivity.
int compareAbc2 = compare(str1$,str2$,case2);
// Will return 1 since the letters are the same, and case sensitivity is 
//turned off. 
compareAbc2=;

See Also

CompareNoCase