From 37aaaf141683be563578cd64d03b69b4e9b87ee8 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 18 Sep 2008 12:26:26 -0700 Subject: [PATCH] Updated printf docs. --- extra/printf/printf-docs.factor | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/extra/printf/printf-docs.factor b/extra/printf/printf-docs.factor index ca26337026..5025fa421f 100755 --- a/extra/printf/printf-docs.factor +++ b/extra/printf/printf-docs.factor @@ -9,19 +9,21 @@ HELP: printf "Writes the arguments formatted according to the format string.\n" { $table { "%%" "Single %" "" } - { "%Pd" "Integer format" "fixnum" } - { "%P.De" "Scientific notation" "fixnum, float" } - { "%P.DE" "Scientific notation" "fixnum, float" } - { "%P.Df" "Fixed format" "fixnum, float" } - { "%Px" "Hexadecimal" "hex" } - { "%PX" "Hexadecimal uppercase" "hex" } { "%P.Ds" "String format" "string" } { "%P.DS" "String format uppercase" "string" } { "%c" "Character format" "char" } { "%C" "Character format uppercase" "char" } + { "%+Pd" "Integer format" "fixnum" } + { "%+P.De" "Scientific notation" "fixnum, float" } + { "%+P.DE" "Scientific notation" "fixnum, float" } + { "%+P.Df" "Fixed format" "fixnum, float" } + { "%+Px" "Hexadecimal" "hex" } + { "%+PX" "Hexadecimal uppercase" "hex" } } "\n" - "Padding ('P') is used to specify the minimum width of the result string, the padding character, and the alignment. By default, the padding character defaults to a space and the alignment defaults to right-aligned. For example:\n" + "A plus sign ('+') is used to optionally specify that the number should be formatted with a '+' preceeding it if positive." + "\n" + "Padding ('P') is used to optionally specify the minimum width of the result string, the padding character, and the alignment. By default, the padding character defaults to a space and the alignment defaults to right-aligned. For example:\n" { $list "\"%5s\" formats a string padding with spaces up to 5 characters wide." "\"%08d\" formats an integer padding with zeros up to 3 characters wide." @@ -29,7 +31,7 @@ HELP: printf "\"%-10d\" formats an integer to 10 characters wide and left-aligns." } "\n" - "Digits ('D') is used to specify the maximum digits in the result string. For example:\n" + "Digits ('D') is used to optionally specify the maximum digits in the result string. For example:\n" { $list "\"%.3s\" formats a string to truncate at 3 characters (from the left)." "\"%.10f\" formats a float to pad-right with zeros up to 10 digits beyond the decimal point." @@ -57,6 +59,10 @@ HELP: printf "USING: printf ;" "12 \"%'#4d\" printf" "##12" } + { $example + "USING: printf ;" + "1234 \"%+d\" printf" + "+1234" } } ; HELP: sprintf