Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #695 (closed enhancement: wontfix)

Opened 12 years ago

Last modified 11 years ago

Need a way to format a number as a code point

Reported by: Deewiant Assigned to: kris
Priority: minor Milestone: 1.0
Component: IO Version: 0.97 RC1
Keywords: triage Cc:


Currently, if one wishes to output a number as both a Unicode code point and a number, one must pass it twice, doing a typecast:

int n;
Stdout.formatln("{} {:d}", cast(dchar)n, n);

Having a Unicode character formatting string would be preferable:

int n;
Stdout.formatln("{0:c} {0:d}", n);

:c would be following from printf and Java's java.util.Formatter, where it's %c. Other possibilities: :u (perhaps too easily confused with printf's %u for unsigned integers), :unicode, :cp, :codepoint.


Integer-unicode.patch (2.4 kB) - added by Deewiant on 05/28/08 07:54:45.
patch for Integer

Change History

11/03/07 03:22:51 changed by kris

  • status changed from new to assigned.
  • milestone set to 1.0.

yeah, that would be nice

05/26/08 19:51:54 changed by kris

  • status changed from assigned to new.
  • owner changed from kris to Deewiant.

you feel like working on this one, deewiant? Both in Layout and in Locale?

05/28/08 07:53:47 changed by Deewiant

Seems to me that the simplest way of doing this is adding it as an option in Integer.format. The only annoyance with this is that it creates a dependency on Utf.

05/28/08 07:54:45 changed by Deewiant

  • attachment Integer-unicode.patch added.

patch for Integer

05/28/08 18:21:52 changed by kris

  • owner changed from Deewiant to kris.
  • status changed from new to assigned.

oh crap, the dependency thing won't fly :(

05/30/08 17:26:41 changed by larsivi

  • keywords set to triage.

10/05/08 06:26:21 changed by kris

  • status changed from assigned to closed.
  • resolution set to wontfix.

In the end I think it is simpler to just cast() instead