Str_CmpIgnoreCase()

Determines if two strings are identical, ignoring case.

Files

lib_str.h/lib_str.c

Prototype

          CPU_INT16S  Str_CmpIgnoreCase (const  CPU_CHAR  *p1_str,
                                         const  CPU_CHAR  *p2_str);

Arguments

p1_str

Pointer to the first string.

p2_str

Pointer to the second string.

Returned Value

Zero value,

if strings are identical (ignoring case); i.e., both strings are identical (ignoring case) for the specified length of characters.

Positive value,

if p1_str is greater than p2_str, ignoring case; i.e., p1_str points to a character (when converted to lower case) of higher value than p2_str for the first non-matching character found.

Negative value,

if p1_str is less than p2_str, ignoring case; i.e., p1_str points to a character (when converted to lower case) of lesser value than p2_str for the first non-matching character found.

Required Configuration

None.

Notes / Warnings

Str_CmpIgnoreCase() behaves as if the two strings were converted to lower case and then compared with Str_Cmp().

String buffers not modified.

String comparison terminates if either string pointer points to or overlaps the NULL address.

Since 16-bit signed arithmetic is performed to calculate a non-identical comparison return value, CPU_CHAR native data type size must be 8-bit.

Example Usage

          CPU_INT16S  cmp;


          cmp = Str_CmpIgnoreCase("Hello World!", "hElLo WoRlD.");

Related pages