compare


Description:

[ Version ( since = "2.26" ) ]
public int compare (Variant other)

Compares this and two.

The types of this and two are gconstpointer only to allow use of this function with Tree, GenericArray, etc. They must each be a Variant.

Comparison is only defined for basic types (ie: booleans, numbers, strings). For booleans, false is less than true. Numbers are ordered in the usual way. Strings are in ASCII lexographical order.

It is a programmer error to attempt to compare container values or two values that have types that are not exactly equal. For example, you cannot compare a 32-bit signed integer with a 32-bit unsigned integer. Also note that this function is not particularly well-behaved when it comes to comparison of doubles; in particular, the handling of incomparable values (ie: NaN) is undefined.

If you only require an equality comparison, equal is more general.

Parameters:

this

a basic-typed Variant instance

two

a Variant instance of the same type

Returns:

negative value if a < b; zero if a = b; positive value if a > b.