String.opCmp

Comparison for equality.

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

Parameters

S

Right hand side type.

that ByCodeUnit!S

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