String.opCmp

Comparison for equality.

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

Parameters

S

Right hand side type.

that ByCodePoint!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