tags:

views:

63

answers:

3

It looks like g_strncasecmp is deprecated, so I am looking for another function to do the same thing.

A: 

g_ascii_strncasecmp for pure ASCII and g_utf8_casefold if you have UTF-8 strings.

Andreas Brinck
+5  A: 

From the docs at http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-strncasecmp

"There are therefore two replacement functions: g_ascii_strncasecmp(), which only works on ASCII and is not locale-sensitive, and g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8."

William Billingsley
A: 

If you're going to be comparing a lot of the same strings, you can gain some speed by creating collation keys. Do this using g_utf8_collate_key(), you can then compare the keys case-insensitively using g_ascii_strcmp() since the collation key is an ASCII string.

unwind