]> gitweb.factorcode.org Git - factor.git/commitdiff
formatting-docs, document ' ' as an alternative to '+' for positive numbers sign...
authorJon Harper <jon.harper87@gmail.com>
Sun, 26 Feb 2017 15:14:52 +0000 (16:14 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 8 Jun 2017 18:23:38 +0000 (11:23 -0700)
basis/formatting/formatting-docs.factor

index d28149c92d58bf4041553bd94983a3ee2dc834de..9d4d267e88b960f4193fe92cf50081bc64157699 100755 (executable)
@@ -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"