Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://www.tcl.tk/man/tcl8.6/TclCmd/format.htm" rel="nofollow">TCL format command manual page</a> specifies that format string can consist of six different parts. In this case second, third and fourth portions are of interest.</p> <p>If there is a character from set [-+ 0#], they specify justification of the field, if there should be padding, sign shown of numbers, etc. 0 in the third example specifies that number should be padded with zeros instead of spaces. However, in this example there is nothing to pad.</p> <p>If there is some other number without dot (2 in the first example), the number is interpreted as minimum field length and number is padded with spaces if necessary.</p> <p>If there is a dot, the number after if interpreted as precision indicator and way it behaves differs depending on the other format parameters. For strings it means the maximum number of characters.</p> <p>With</p> <pre><code>format %4.2s foo </code></pre> <p>you then get</p> <pre><code> fo </code></pre> <p>That is, at most two characters are printed, but the field width is at minimum 4 characters.</p> <p>If you are actually trying to print a number instead of string, then the sixth (the only mandatory) field is important. "s" means "print as is". For numbers you want to use for example "d" which means decimal (integer) or "f" for floating point. Check the manual for the whole list.</p> <p>With</p> <pre><code>format %4.2d 100 # Print with at least two numbers and with field width of 4 characters </code></pre> <p>you get</p> <pre><code> 100 </code></pre> <p>With </p> <pre><code>format %08.2f 123.45678 # Field width 8, pad with zeros, print two decimals </code></pre> <p>you get</p> <pre><code>00123.46 </code></pre> <p>In the last example notice that all numbers and the dot are counted for the field length and that the number has been rounded.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload