Compare strings


strcmp( const string1[], const string2[], bool:ignorecase=false, length=1024 )

Compare string1 and string2


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 0
  • ezeio2/scriptref/strcmp.txt
  • Last modified: 2019-09-02 21:42
  • by andreh