Function

GLibstrcmp0

since: 2.16

Declaration

int
g_strcmp0 (
  const char* str1,
  const char* str2
)

Description

Compares str1 and str2 like strcmp(). Handles NULL gracefully by sorting it before non-NULL strings. Comparing two NULL pointers returns 0.

Available since: 2.16

Parameters

str1

Type: const char*

A C string or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
str2

Type: const char*

Another C string or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: int

An integer less than, equal to, or greater than zero, if str1 is <, == or > than str2.