Function BasicString.erase

Removes specified characters from the string.

void erase (
  const size_t pos
) pure nothrow @nogc scope @trusted;

void erase (
  const size_t pos,
  const size_t n
) pure nothrow @nogc scope @trusted;

void erase (
  scope const BasicString.CharType* ptr
) pure nothrow @nogc scope @trusted;

void erase (
  scope const BasicString.CharType[] slice
) pure nothrow @nogc scope @trusted;

Parameters

pos position of first character to be removed.

n number of character to be removed.

ptr pointer to character to be removed.

slice sub-slice to be removed, slice must be subset of this

Examples

{
	BasicString!char str = "123456";

	str.erase(2);
	assert(str == "12");
}

{
	BasicString!char str = "123456";

	str.erase(1, 2);
	assert(str == "1456");
}

{
	BasicString!char str = "123456";

	str.erase(str.ptr + 2);
	assert(str == "12");
}

{
	BasicString!char str = "123456";

	str.erase(str[1 .. $-1]);
	assert(str == "16");
}