Core Function StrCmp

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (1 revision)

Revision as of 12:37, 14 June 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

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
*/
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox