1

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

4

3 回答 3

5

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."

于 2009-12-08T09:17:41.963 回答
0

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

于 2009-12-08T09:17:25.423 回答
0

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.

于 2009-12-08T09:17:59.727 回答