stripEffects

Removes all form of mIRC formatting (colours, bold, italics, underlined) from a string.

@safe pure nothrow
stripEffects
(
const string line
)

Parameters

line string

String to strip effects from.

Return Value

Type: auto

A string devoid of effects.

Examples

alias I = IRCControlCharacter;

enum boldCode = "" ~ I.bold;
enum italicsCode = "" ~ I.italics;

{
    immutable withTags = "This is " ~ boldCode ~ "riddled" ~ boldCode ~ " with " ~
        italicsCode ~ "tags" ~ italicsCode;
    immutable without = stripEffects(withTags);
    assert((without == "This is riddled with tags"), without);
}
{
    immutable withTags = "This line has no tags.";
    immutable without = stripEffects(withTags);
    assert((without == withTags), without);
}
{
    string withTags;
    immutable without = stripEffects(withTags);
    assert(!without.length, without);
}