View source code Display the source code in std/uni.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Function std.uni.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
  • Prototype

    void toString(
      void delegate(const(char)[]) sink,
      FormatSpec!char fmt
    );

    Example

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

    Authors

    Dmitry Olshansky

    License

    Boost License 1.0.

    Comments