NAME

cmpstr - string comparison

SYNOPSIS

#include <basic/string.h>

int cmpstr(a, b)
struct string *a, *b;

DESCRIPTION

Cmpstr returns an integer which represents the comparison of the strings pointed to by a and b.  That the string pointed to by a is less than, equal to or greater than the string pointed to by b is represented by a return value which is less than, equal to or greater than zero, respectively. 

One by one, the characters of each string are compared until a pair differs.  The comparison of the two strings is then equivalent to the comparison of the pair of differing characters.  If all the pairs are equal, but one string is shorter than the other, the comparison of the two strings is then equivalent to the comparison of the lengths of the strings.  Otherwise, the strings are equal because all pairs are equal and the strings have the same length.  When characters are compared no interpretation takes place, i.e., the characters are regarded as one byte (unsigned) numeric values and are compared as such.  If one regards the characters as ASCII symbols the ordering is that of the ASCII character set and is similar to that which one intuitively expects.  The method is equivalent to that used by sort(1) and strcmp (see string(3)). 

This function implements string comparison. 

SEE ALSO

string(inc)
sort(1), string(3) in the UNIX Programmerís Manual

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber