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, Flag!"extendedOutgoingColours" extendedOutgoingColours, Flag!"strip" strip)
    @safe @system
    expandIRCTags
    (
    T
    )
    (
    const T line
    ,
    const Flag!"extendedOutgoingColours" extendedOutgoingColours
    ,
    const Flag!"strip" strip
    )
  2. auto expandIRCTags(T line)

Parameters

line T

String line to expand IRC tags of.

extendedOutgoingColours Flag!"extendedOutgoingColours"

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

strip Flag!"strip"

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

import std.typecons : Flag, No, Yes;

// See unit tests of other overloads for more No.strip tests

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