expandIRCTags

Slightly more complicated, but essentially string-replaces <tags> in an outgoing IRC string with correlating formatting using IRCControlCharacters in their syntax. Overload that takes an explicit strip Flag.

  1. auto expandIRCTags(T line, bool extendedOutgoingColours, bool strip)
    @safe @system
    expandIRCTags
    (
    T
    )
    (
    const T line
    ,,
    const bool strip
    )
  2. auto expandIRCTags(T line)

Parameters

line T

String line to expand IRC tags of.

extendedOutgoingColours bool

Whether or not to use extended colours (16-99).

strip bool

Whether to expand tags or strip them from the input line.

Return Value

Type: auto

The passed line but with tags expanded to formatting and colouring.

Examples

// See unit tests of other overloads for more `strip: false` tests

{
    immutable line = "hello<b>hello<b>hello";
    immutable expanded = line.expandIRCTags(extendedOutgoingColours: true, strip: true);
    immutable expected = "hellohellohello";
    assert((expanded == expected), expanded);
}
{
    immutable line = "hello<99,99<b>hiho</>";
    immutable expanded = line.expandIRCTags(extendedOutgoingColours: true, strip: true);
    immutable expected = "hello<99,99hiho";
    assert((expanded == expected), expanded);
}
{
    immutable line = "hello<1>hellohello";
    immutable expanded = line.expandIRCTags(extendedOutgoingColours: true, strip: true);
    immutable expected = "hellohellohello";
    assert((expanded == expected), expanded);
}
{
    immutable line = `hello\<h>hello<h>hello<h>hello`;
    immutable expanded = line.expandIRCTags(extendedOutgoingColours: true, strip: true);
    immutable expected = "hello<h>hellohellohello";
    assert((expanded == expected), expanded);
}