Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Printf
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Flags field=== The flags field can be zero or more of (in any order): {{Table alignment}} {| class="wikitable col1center" |- ! Text ! Description |- | {{tt|-}} |Left-align the output of this placeholder; default is to right-align the output |- | {{tt|+}} |Prepends a plus sign for a positive value; by default a positive value does not have a prefix |- | <code style="white-space:pre"> </code><br />(space) |Prepends a space character for a positive value; ignored if the {{tt|+}} flag exists; by default a positive value does not have a prefix |- | {{tt|0}} |When the 'width' option is specified, prepends zeros for numeric types; by prepends spaces; for example, {{code|printf("%4X",3)|c}} produces <samp style="white-space:pre">" 3"</samp>, while {{code|printf("%04X",3);|c}} produces {{samp|"0003"}} |- | {{tt|'}} | The integer or exponent of a decimal has the thousands grouping separator applied |- | {{tt|#}} | Alternate form:<br /> For {{tt|g}} and {{tt|G}} types, trailing zeros are not removed<br /> For {{tt|f}}, {{tt|F}}, {{tt|e}}, {{tt|E}}, {{tt|g}}, {{tt|G}} types, the output always contains a decimal point<br /> For {{tt|o}}, {{tt|x}}, {{tt|X}} types, the text {{tt|0}}, {{tt|0x}}, {{tt|0X}}, respectively, is prepended to non-zero numbers |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)