Function

GLibascii_strcasecmp

Declaration

gint
g_ascii_strcasecmp (
  const gchar* s1,
  const gchar* s2
)

Description

Compare two strings, ignoring the case of ASCII characters.

Unlike the BSD strcasecmp() function, this only recognizes standard ASCII letters and ignores the locale, treating all non-ASCII bytes as if they are not letters.

This function should be used only on strings that are known to be in encodings where the bytes corresponding to ASCII letters always represent themselves. This includes UTF-8 and the ISO-8859-* charsets, but not for instance double-byte encodings like the Windows Codepage 932, where the trailing bytes of double-byte characters include all ASCII letters. If you compare two CP932 strings using this function, you will get false matches.

Both s1 and s2 must be non-NULL.

Parameters

s1

Type: const gchar*

String to compare with s2

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
s2

Type: const gchar*

String to compare with s1

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: gint

0 if the strings match, a negative value if s1 < s2, or a positive value if s1 > s2