Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

strcmp <string> <string>

strcmp is undoable, queryable, and editable.

Compares its 2 string arguments and returns an integer less than, equal to, or greater than 0, based upon whether the first argument is lexicographically less than, equal to, or greater than the second argument.

Return value

int

In query mode, return type is based on queried flag.

Related

gmatch, match

MEL examples

string $s1="hello";
string $s2="goodbye";
int $compare = `strcmp $s1 $s2`;
// Result: 1 //
$compare = `strcmp $s2 $s1`;
// Result: -1 //
$compare = `strcmp "hello" $s1`;
// Result: 0 //