strcmp, stricmp

strcmp, stricmp — compare strings.

Syntax

strcmp (string, string)
stricmp (string, string)

		

Arguments

string

Any string.

Returns

A negative number if the first string is ordinally less than the second string according to the ASCII character set, a positive number if the first string is greater than the second, and zero if the two strings are exactly equal.

Description

These functions can be used as comparison functions for sort and insert. stricmp performs the same function as strcmp, but alphabetic characters are compared without regard to case. That is, "A" and "a" are considered equal by stricmp, but different by strcmp.

Example

Gamma> strcmp("apple", "peach");
-15
Gamma> strcmp("peach", "apple");
15
Gamma> strcmp("Apple","Apple");
0
Gamma> strcmp("Apple","Apple pie");
-32
Gamma> strcmp("Apple","apple");
-32
Gamma> stricmp("Apple","apple");
0
Gamma> 
	

See Also

insert, sort, strchr, strrchr