-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Alternative integer format #120
Comments
Thanks for the suggestions, but the format syntax is mostly based on str.format where fmt::printf("%i", 42); |
Hi Victor Thanks for the reply. I see now that the format syntax is very closely aligned with Python’s str.format function. To be honest I was looking at ways where I could maybe contribute to your open source project. I spent 4 hours looking at it yesterday and I couldn’t see any holes in it that I could quickly fill. Could you let me know what the main reasons why someone would use fmt::printf over normal c library printf. Is it to get the exception handling support ? Please let me know if there is anything I can help you with. My main programming language is C++ but lately I have been also programming in python Thanks for your prompt reply. Best regards Andrew From: Victor Zverovich [mailto:notifications@github.com] Thanks for the suggestions, but the format syntax is mostly based on str.format https://docs.python.org/2/library/string.html#formatstrings where d is used for decimal integers. The one you refer to applies to the Python's interpolation operator % and is similar to printf. The C++ Format library already support "i" specifier in fmt::printf: fmt::printf("%i", 42); — |
Hi Andrew, It's great that you are interested in contributing to C++ Format.
That said,
I suggest choosing something you are interested in working on from Issues. For example, implementing custom streambuf in Issue #92 or replacing use of Thanks, |
I noted in the documentation that the format syntax is based on python. In python two forms of syntax are allowed for integer both "d" and "i". see following link
https://docs.python.org/2/library/stdtypes.html#string-formatting
This code gives an exception as "i" integer format is not allowed:
fmt::print("int: {0:d}; alternative int: {0:i}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);
Should you allow the "i" format in a later release ?
The text was updated successfully, but these errors were encountered: