String.remove

Remove all characters beloning to r.

struct String
@trusted
R
remove
(
R
)
(
R r
)
if (
is(R == ByCodeUnit!char) ||
is(R == ByCodePoint!char)
)

Parameters

R

$(D_PSYMBOL ByCodeUnit) or $(D_PSYMBOL ByCodePoint).

r R

Range originally obtained from this string.

Return Value

Type: R

A range spanning the remaining characters in the string that initially were right after r.

Precondition: r refers to a region of $(D_KEYWORD this).

Examples

import std.algorithm.searching : count;

auto s = String("Из пословицы слова не выкинешь.");

assert(s.remove(s[5 .. 24]).length == 33);
assert(s == "Из слова не выкинешь.");
assert(s.length == 38);

auto byCodePoint = s.byCodePoint();
popFrontN(byCodePoint, 8);

assert(s.remove(byCodePoint).count == 0);
assert(s == "Из слова");

assert(s.remove(s[]).length == 0);
assert(s.length == 0);

assert(s.remove(s[]).length == 0);

Meta