Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add advanced printf-style formatting options to w::format. #3

Open
simonask opened this issue Jun 15, 2014 · 0 comments
Open

Add advanced printf-style formatting options to w::format. #3

simonask opened this issue Jun 15, 2014 · 0 comments
Assignees
Milestone

Comments

@simonask
Copy link
Owner

Currently w::format only does plain interpolation. It would be great if it could support syntax like this:

w::format("{0:.2}", 123); // => "0.00"

The format options should be per-interpolation, so the same argument can be interpolated multiple times with different format arguments:

w::format("{0:09.2} <=> {0:+x}", 10); // => "000000010.00 <=> +0xa"

For numbers (both integers and floats), all the options of POSIX printf should be supported. If a float-options is given to with an integer argument, or vice versa, the input value should be static_cast'ed to the appropriate type before interpolation.

Hexadecimal presentation formats should reinterpret_cast the input to a matching integer representation.

@simonask simonask added this to the 0.0.1-alpha milestone Jun 15, 2014
@simonask simonask self-assigned this Jun 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant