stripColours

Removes IRC colouring from a passed string.

Merely calls mapColours with a Yes.strip template parameter.

@safe pure nothrow
stripColours
(
const string line
)

Parameters

line string

String to strip of IRC colour tags.

Return Value

Type: auto

The passed line, now stripped of IRC colours.

Examples

alias I = IRCControlCharacter;

{
    immutable line = "This is " ~ I.colour ~ "4all red!" ~ I.colour ~ " while this is not.";
    immutable stripped = line.stripColours();
    assert((stripped == "This is all red! while this is not."), stripped);
}
{
    immutable line = "This time there's" ~ I.colour ~ "6 no ending token, only magenta.";
    immutable stripped = line.stripColours();
    assert((stripped == "This time there's no ending token, only magenta."), stripped);
}
{
    immutable line = "This time there's" ~ I.colour ~ "6 no ending " ~ I.colour ~
        "6token, only " ~ I.colour ~ "magenta.";
    immutable stripped = line.stripColours();
    assert((stripped == "This time there's no ending token, only magenta."), stripped);
}