formatting-docs, document ' ' as an alternative to '+' for positive numbers sign prefixing

modern-harvey2
Jon Harper 2017-02-26 16:14:52 +01:00 committed by John Benediktsson
parent 6061da92be
commit 762b22e1a8
1 changed files with 16 additions and 14 deletions

View File

@ -19,22 +19,22 @@ HELP: printf
{ { $snippet "%P.Du" } "Unparsed format" "object" }
{ { $snippet "%c" } "Character format" "char" }
{ { $snippet "%C" } "Character format uppercase" "char" }
{ { $snippet "%+Pd" } "Base 10 General format" "real" }
{ { $snippet "%+Px" } "Base 16 General format" "real" }
{ { $snippet "%+PX" } "Base 16 General format uppercase" "real" }
{ { $snippet "%+Po" } "Base 8 General format" "real" }
{ { $snippet "%+PO" } "Base 8 General format uppercase" "real" }
{ { $snippet "%+Pb" } "Base 2 General format" "real" }
{ { $snippet "%+PB" } "Base 2 General format uppercase" "real" }
{ { $snippet "%+P.De" } "Base 10 Scientific format" "real" }
{ { $snippet "%+P.DE" } "Base 10 Scientific format uppercase" "real" }
{ { $snippet "%+P.Df" } "Base 10 Fixed format" "real" }
{ { $snippet "%LPd" } "Base 10 General format" "real" }
{ { $snippet "%LPx" } "Base 16 General format" "real" }
{ { $snippet "%LPX" } "Base 16 General format uppercase" "real" }
{ { $snippet "%LPo" } "Base 8 General format" "real" }
{ { $snippet "%LPO" } "Base 8 General format uppercase" "real" }
{ { $snippet "%LPb" } "Base 2 General format" "real" }
{ { $snippet "%LPB" } "Base 2 General format uppercase" "real" }
{ { $snippet "%LP.De" } "Base 10 Scientific format" "real" }
{ { $snippet "%LP.DE" } "Base 10 Scientific format uppercase" "real" }
{ { $snippet "%LP.Df" } "Base 10 Fixed format" "real" }
{ { $snippet "%[%?, %]" } "Sequence format" "sequence" }
{ { $snippet "%[%?: %? %]" } "Assocs format" "assocs" }
}
$nl
"A plus sign (" { $snippet "+" } ") is used to optionally specify that the number should be "
"formatted with a " { $snippet "+" } " preceeding it if positive."
"Leading (" { $snippet "L" } ") is used to optionally prefix a plus sign (" { $snippet "\"+\"" } ") or space (" { $snippet "\" \"" } ") "
"if the formatted number is positive."
$nl
"Padding (" { $snippet "P" } ") is used to optionally specify the minimum width of the result "
"string, the padding character, and the alignment. By default, the padding "
@ -80,8 +80,10 @@ HELP: printf
"##12" }
{ $example
"USING: formatting ;"
"1234 \"%+d\" printf"
"+1234" }
" 1234 \"%+d\\n\" printf"
"-1234 \"%+d\\n\" printf"
" 1234 \"% d\\n\" printf"
"+1234\n-1234\n 1234" }
{ $example
"USING: formatting ;"
"{ 1 2 3 } \"%[%d, %]\" printf"