Some cleanup of printf and better docs.
parent
0240427ab3
commit
388bf88d0f
extra/printf
|
@ -39,7 +39,9 @@ HELP: sprintf
|
|||
{ $see-also printf } ;
|
||||
|
||||
ARTICLE: "printf" "Formatted printing"
|
||||
"The " { $vocab-link "printf" } " and " { $vocab-link "sprintf" } " words are used for formatted printing.\n"
|
||||
"The " { $vocab-link "printf" } " vocabulary is used for formatted printing.\n"
|
||||
{ $subsection printf }
|
||||
{ $subsection sprintf }
|
||||
"\n"
|
||||
"Several format specifications exist for handling arguments of different types, and specifying attributes for the result string, including such things as maximum width, padding, and decimals.\n"
|
||||
{ $table
|
||||
|
@ -72,3 +74,7 @@ ARTICLE: "printf" "Formatted printing"
|
|||
"\"%.10f\" formats a float to pad-right with zeros up to 10 digits beyond the decimal point."
|
||||
"\"%.5E\" formats a float into scientific notation with zeros up to 5 digits beyond the decimal point, but before the exponent."
|
||||
} ;
|
||||
|
||||
ABOUT: "printf"
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ USING: kernel printf tools.test ;
|
|||
|
||||
[ "%s" sprintf ] must-infer
|
||||
|
||||
[ t ] [ "" "" sprintf = ] unit-test
|
||||
|
||||
[ t ] [ "asdf" "asdf" sprintf = ] unit-test
|
||||
|
||||
[ t ] [ "10" 10 "%d" sprintf = ] unit-test
|
||||
|
||||
[ t ] [ "+10" 10 "%+d" sprintf = ] unit-test
|
||||
|
|
Loading…
Reference in New Issue