SYNOPSIS
       #include <string.h>

       int strcasecmp(const char *s1, const char *s2);

       int strncasecmp(const char *s1, const char *s2, size_t n);
DESCRIPTION
This str function compares two variable length strings, "ignoring the case of the characters". Returns a number < 0 if s1 is found to be less than s2, 0 if they match, and > 0 if s1 is found to be greater than s2.

In strncasecmp, only the first n characters are compared.

NOTES
The uses for this function are straight forward enough... Although primarily in MS-DOS, I'd imagine, as most things in unix are case sensitive. Still, if you were writing an IRC bot, or something else where approximate matches are good enough, this function would be more efficient than first converting to upper/lower case and comparing.

This function is compliant with the Unix 98 standard. PHP, however, provides it.


This documentation almost shamelessly lifted from the man pages on my Debian box. The man page is dated April 11, 1993.

Log in or registerto write something here or to contact authors.