- Reference
- Script reference
- Strings and buffers
strcmp
Compare string1 and string2
Compare strings
Description#
strcmp( const string1[], const string2[], bool:ignorecase=false, length=1024 )Compare string1 and string2
Parameters#
string1 | first string to be compared |
string2 | second string to be compared |
ignorecase (optional) | if set to true (1), ignore the case |
length (optional) | max number of characters to compare |
Return value#
Returns 0 if the strings are equal.
Returns 1 if string1 > string2.
Returns -1 if string1 < string2.
Example usage#
new x;
new s1{20} = "ABC";
new s2{20} = "abc";
x = strcmp(s1, s2, true); // ignore case
// x is now 0Last updated Sep 2, 2019