Function BasicString.opAssign

Assigns a new value rhs to the string, replacing its current contents.

void opAssign (
  typeof(null) nil
) pure nothrow @nogc scope @safe;

void opAssign (
  scope const BasicString.CharType[] slice
) scope;

void opAssign(C) (
  scope const C[] slice
) scope
if (isSomeChar!C);

void opAssign(C) (
  const C character
) scope
if (isSomeChar!C);

void opAssign(I) (
  const I integer
) scope
if (isIntegral!I);

void opAssign (
  scope typeof(this) rhs
) scope;

void opAssign(Rhs) (
  auto scope ref Rhs rhs
) scope
if (isBasicString!Rhs && isAssignable!(Rhs, typeof(this)));

Parameter rhs can by type of null, BasicString!(...), char|wchar|dchar array/slice/character or integer (integer is transformed to string).

Return referece to this.

Examples

BasicString!char str = "123";
assert(!str.empty);

str = null;
assert(str.empty);

str = 'X';
assert(str == "X");

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

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

str = BasicString!char("42");
assert(str == "42");

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