View source code
Display the source code in std/uni.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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.

Function std.uni.InversionList.toString

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

void toString(Writer) (
  scope Writer sink,
  scope const ref FormatSpec!char fmt
);

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
  • Example

    import std.conv : to;
    import std.format : format;
    import std.uni : unicode;
    
    // This was originally using Cyrillic script.
    // Unfortunately this is a pretty active range for changes,
    // and hence broke in an update.
    // Therefore the range Basic latin was used instead as it
    // unlikely to ever change.
    
    writeln(unicode.InBasic_latin.to!string); // "[0..128)"
    
    // The specs '%s' and '%d' are equivalent to the to!string call above.
    writeln(format("%d", unicode.InBasic_latin)); // unicode.InBasic_latin.to!string
    
    writeln(format("%#x", unicode.InBasic_latin)); // "[0..0x80)"
    writeln(format("%#X", unicode.InBasic_latin)); // "[0..0X80)"
    
    

    Authors

    Dmitry Olshansky

    License

    Boost License 1.0.