Product: MapBasic
Version: 6.5
Platform: Not Platform Related
Category: Documentation
Summary:
StringCompare function - Description
Question:
How is the StringCompare function used?
Answer:
StringCompare( ) function
Purpose
Performs case-sensitive string comparisons.
Syntax
StringCompare( string1, string2 )
string1 and string2 are String expressions
Return Value
SmallInt: -1 if first string precedes second; 1 if first string follows second; zero if strings are equal
Description
The StringCompare( ) function performs case-sensitive string comparisons. MapBasic string comparisons which use the "=" operator are case-insensitive. Thus, a comparison expression such as the following:
If "ABC" = "abc" Then
evaluates as TRUE, because string comparisons are case-insensitive.
The StringCompare( ) function performs a case-sensitive string comparison and returns an indication of how the strings compare.
Return value:
When:
-1 first string precedes the second string, alphabetically
0 the two strings are equal
1 first string follows the second string, alphabetically
Example
The function call:
StringCompare("ABC", "abc")
returns a value of -1, since "A" precedes "a" in the set of character codes.
See Also
String functions
Last Modified: 08/21/2001 02:07:15 PM
|