String.opCmp

Comparison for equality.

  1. int opCmp(S that)
  2. int opCmp(ByCodeUnit!S that)
  3. int opCmp(ByCodePoint!S that)
  4. int opCmp(char[] that)
    struct String
    const @trusted
    int
    opCmp
    ()
    (
    const char[] that
    )

Parameters

that char[]

The string to compare with.

Return Value

Type: int

A positive number if $(D_KEYWORD this) is lexicographically greater than that, if equal 0, else -1.

Examples

assert(String("Голубая кофта.") < String("Синие глаза."));
assert(String("Никакой я правды") < String("милой не сказал")[]);

Meta