Function BasicString.opEquals

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

bool opEquals (
  scope const BasicString.CharType[] rhs
) const pure nothrow @nogc scope @safe;

bool opEquals(Rhs) (
  auto scope ref Rhs rhs
) const scope
if (isBasicString!Rhs || isSomeChar!Rhs || isSomeString!Rhs || isCharArray!Rhs || isIntegral!Rhs || isInputCharRange!Rhs);

Returns true if they are equal, false otherwise

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);