BasicString.opEquals

Compares the contents of a string with another string, range, char/wchar/dchar or integer.

Returns true if they are equal, false otherwise

  1. bool opEquals(CharType[] rhs)
    struct BasicString
    const scope pure nothrow @safe @nogc
    bool
    opEquals
    (
    scope const CharType[] rhs
    )
  2. bool opEquals(Rhs rhs)

Examples

BasicString!char str = "123";

assert(str == "123");
assert("123" == str);

assert(str == "123"w);
assert("123"w == str);

assert(str == "123"d);
assert("123"d == str);

assert(str == BasicString!wchar("123"));
assert(BasicString!wchar("123") == str);

assert(str == 123);
assert(123 == str);

import std.range : only;
assert(str == only('1', '2', '3'));
assert(only('1', '2', '3') == str);

Meta