Function String.remove
Remove all characters beloning to r.
R remove(R)
(
R r
) @trusted
if (is(R == ByCodeUnit!char) || is(R == ByCodePoint!char));
Parameters
Name | Description |
---|---|
R | ByCodeUnit or ByCodePoint. |
r | Range originally obtained from this string. |
Returns
A range spanning the remaining characters in the string that initially were right after r.
Precondition
r refers to a region of this.
Example
import tanya .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);