String.opCmp

Comparison for equality.

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

Parameters

S

Right hand side type.

that 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