Core Function StrCmp
From Sputnik Wiki
(Difference between revisions)
m (1 revision) |
(→ignoreCase) |
||
Line 25: | Line 25: | ||
true = Ignore case and match case insensitively | true = Ignore case and match case insensitively | ||
− | false = Case must be an exact match | + | false = Case must be an exact match |
+ | |||
+ | Default: false | ||
=== Return Value === | === Return Value === |
Revision as of 21:08, 16 September 2015
StrCmp( <str1>, <str2>, <ignoreCase> )
Contents |
Description
String comparison.
Used to compare if two strings are equal/lesser or greater.
Parameters
str1
The first string.
str2
The second string.
ignoreCase
Optional; Do case insensitive match
true = Ignore case and match case insensitively
false = Case must be an exact match
Default: false
Return Value
-1 if str1 is less than str2
1 if str1 is greater than str2
0 if they are equal.
Remarks
None.
Example
echo (StrCmp("Hello", "Hello") . "\n"); echo (StrCmp("Hello", "HellO") . "\n"); echo (StrCmp("Hello", "HellO", true) . "\n"); echo (StrCmp("HellO", "Hello") . "\n"); echo (StrCmp("HellO", "Hello", true) . "\n"); /* 0 -1 0 1 0 */