EDataServer.Collator.generate_key

### Method

# EDataServer Collatorgenerate_key

since: 3.12

#### Declaration [src]

    gchar*
    e_collator_generate_key (
      ECollator* collator,
      const gchar* str,
      GError** error
    )

#### Description [src]

Generates a collation key for `str`, the result of comparing two collation keys with `strcmp()` will be the same result of calling `e_collator_collate()` on the same original strings.

This function will first ensure that `str` is valid UTF-8 encoded.

Available since: 3.12

#### Parameters

`str`

  Type: `const gchar*`

  The string to generate a collation key for.

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

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gchar*`

A collation key for `str`, or `NULL` on failure with `error` set.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.