Function String.opCmp

Comparison for equality.

int opCmp(S) (
  auto ref S that
) const @trusted
if (is(Unqual!S == String));

int opCmp(S) (
  ByCodeUnit!S that
) const @trusted
if (is(Unqual!S == char));

int opCmp(S) (
  ByCodePoint!S that
) const @trusted
if (is(Unqual!S == char));

int opCmp (
  const char[] that
) const @trusted;

Parameters

NameDescription
S Right hand side type.
that The string to compare with.

Returns

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

Example

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