Function

GLib-2.0GLibutf8_collate_key

  • Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().

    The results of comparing the collation keys of two strings with strcmp() will always be the same as comparing the two original keys with g_utf8_collate().

    Note that this function depends on the current locale.

    Note that the returned string is not guaranteed to be in any encoding, especially UTF-8. The returned value is meant to be used only for comparisons.

    Parameters

    • str: string

      a UTF-8 encoded string.

    • len: number

      length of str, in bytes, or -1 if str is nul-terminated.

    Returns string

    a newly allocated string. The contents of the string are only meant to be used when sorting. This string should be freed with g_free() when you are done with it.