GLib.utf8_collate

function utf8_collate(str1: String, str2: String): Number(gint) {
    // Gjs wrapper for g_utf8_collate()
}
  

Compares two strings for ordering using the linguistically correct rules for the [current locale][setlocale]. When sorting a large number of strings, it will be significantly faster to obtain collation keys with GLib.utf8_collate_key and compare the keys with strcmp() when sorting instead of sorting the original strings.

str1

a UTF-8 encoded string

str2

a UTF-8 encoded string

Returns

< 0 if str1 compares before str2, 0 if they compare equal, > 0 if str1 compares after str2.