InversionList.toString

Obtain a textual representation of this InversionList in form of open-right intervals.

The formatting flag is applied individually to each value, for example:

  • %s and %d format the intervals as a [low .. high) range of integrals
  • %x formats the intervals as a [low .. high) range of lowercase hex characters
  • %X formats the intervals as a [low .. high) range of uppercase hex characters
  • struct InversionList(SP = GcPolicy)
    void
    toString
    (
    Writer
    )
    (
    scope Writer sink
    ,
    scope const ref FormatSpec!char fmt
    )

    Examples

    1 import std.conv : to;
    2 import std.format : format;
    3 import std.uni : unicode;
    4 
    5 assert(unicode.Cyrillic.to!string ==
    6     "[1024..1157) [1159..1320) [7467..7468) [7544..7545) [11744..11776) [42560..42648) [42655..42656)");
    7 
    8 // The specs '%s' and '%d' are equivalent to the to!string call above.
    9 assert(format("%d", unicode.Cyrillic) == unicode.Cyrillic.to!string);
    10 
    11 assert(format("%#x", unicode.Cyrillic) ==
    12     "[0x400..0x485) [0x487..0x528) [0x1d2b..0x1d2c) [0x1d78..0x1d79) [0x2de0..0x2e00) "
    13     ~"[0xa640..0xa698) [0xa69f..0xa6a0)");
    14 
    15 assert(format("%#X", unicode.Cyrillic) ==
    16     "[0X400..0X485) [0X487..0X528) [0X1D2B..0X1D2C) [0X1D78..0X1D79) [0X2DE0..0X2E00) "
    17     ~"[0XA640..0XA698) [0XA69F..0XA6A0)");

    Meta

    Suggestion Box / Bug Report