PHP 8.2.31
Preview: sprintf-i.yaml Size: 6.11 KB
/proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Kernel/sprintf-i.yaml

--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Returns the string resulting from applying <em>format_string</em> to any additional arguments. Within the format string, any characters other than format sequences are copied to the result. A format sequence consists of a percent sign, followed by optional flags, width, and precision indicators, then terminated with a field type character. The field type controls how the corresponding <tt>sprintf</tt> argument is to be interpreted, while the flags modify that interpretation. The field type characters are listed in the table at the end of this section. The flag characters are:"
- !ruby/struct:SM::Flow::VERB 
  body: "  Flag     | Applies to   | Meaning\n  ---------+--------------+-----------------------------------------\n  space    | bdeEfgGiouxX | Leave a space at the start of\n           |              | positive numbers.\n  ---------+--------------+-----------------------------------------\n  (digit)$ | all          | Specifies the absolute argument number\n           |              | for this field. Absolute and relative\n           |              | argument numbers cannot be mixed in a\n           |              | sprintf string.\n  ---------+--------------+-----------------------------------------\n   #       | beEfgGoxX    | Use an alternative format. For the\n           |              | conversions `o', `x', `X', and `b',\n           |              | prefix the result with ``0'', ``0x'', ``0X'',\n           |              |  and ``0b'', respectively. For `e',\n           |              | `E', `f', `g', and 'G', force a decimal\n           |              | point to be added, even if no digits follow.\n           |              | For `g' and 'G', do not remove trailing zeros.\n  ---------+--------------+-----------------------------------------\n  +        | bdeEfgGiouxX | Add a leading plus sign to positive numbers.\n  ---------+--------------+-----------------------------------------\n  -        | all          | Left-justify the result of this conversion.\n  ---------+--------------+-----------------------------------------\n  0 (zero) | bdeEfgGiouxX | Pad with zeros, not spaces.\n  ---------+--------------+-----------------------------------------\n  *        | all          | Use the next argument as the field width.\n           |              | If negative, left-justify the result. If the\n           |              | asterisk is followed by a number and a dollar\n           |              | sign, use the indicated argument as the width.\n"
- !ruby/struct:SM::Flow::P 
  body: The field width is an optional integer, followed optionally by a period and a precision. The width specifies the minimum number of characters that will be written to the result for this field. For numeric fields, the precision controls the number of decimal places displayed. For string fields, the precision determines the maximum number of characters to be copied from the string. (Thus, the format sequence <tt>%10.10s</tt> will always contribute exactly ten characters to the result.)
- !ruby/struct:SM::Flow::P 
  body: "The field types are:"
- !ruby/struct:SM::Flow::VERB 
  body: "    Field |  Conversion\n    ------+--------------------------------------------------------------\n      b   | Convert argument as a binary number.\n      c   | Argument is the numeric code for a single character.\n      d   | Convert argument as a decimal number.\n      E   | Equivalent to `e', but uses an uppercase E to indicate\n          | the exponent.\n      e   | Convert floating point argument into exponential notation\n          | with one digit before the decimal point. The precision\n          | determines the number of fractional digits (defaulting to six).\n      f   | Convert floating point argument as [-]ddd.ddd,\n          |  where the precision determines the number of digits after\n          | the decimal point.\n      G   | Equivalent to `g', but use an uppercase `E' in exponent form.\n      g   | Convert a floating point number using exponential form\n          | if the exponent is less than -4 or greater than or\n          | equal to the precision, or in d.dddd form otherwise.\n      i   | Identical to `d'.\n      o   | Convert argument as an octal number.\n      p   | The valuing of argument.inspect.\n      s   | Argument is a string to be substituted. If the format\n          | sequence contains a precision, at most that many characters\n          | will be copied.\n      u   | Treat argument as an unsigned decimal number. Negative integers\n          | are displayed as a 32 bit two's complement plus one for the\n          | underlying architecture; that is, 2 ** 32 + n.  However, since\n          | Ruby has no inherent limit on bits used to represent the\n          | integer, this value is preceded by two dots (..) in order to\n          | indicate a infinite number of leading sign bits.\n      X   | Convert argument as a hexadecimal number using uppercase\n          | letters. Negative numbers will be displayed with two\n          | leading periods (representing an infinite string of\n          | leading 'FF's.\n      x   | Convert argument as a hexadecimal number.\n          | Negative numbers will be displayed with two\n          | leading periods (representing an infinite string of\n          | leading 'ff's.\n"
- !ruby/struct:SM::Flow::P 
  body: "Examples:"
- !ruby/struct:SM::Flow::VERB 
  body: "   sprintf(&quot;%d %04x&quot;, 123, 123)               #=&gt; &quot;123 007b&quot;\n   sprintf(&quot;%08b '%4s'&quot;, 123, 123)            #=&gt; &quot;01111011 ' 123'&quot;\n   sprintf(&quot;%1$*2$s %2$d %1$s&quot;, &quot;hello&quot;, 8)   #=&gt; &quot;   hello 8 hello&quot;\n   sprintf(&quot;%1$*2$s %2$d&quot;, &quot;hello&quot;, -8)       #=&gt; &quot;hello    -8&quot;\n   sprintf(&quot;%+g:% g:%-g&quot;, 1.23, 1.23, 1.23)   #=&gt; &quot;+1.23: 1.23:1.23&quot;\n   sprintf(&quot;%u&quot;, -123)                        #=&gt; &quot;..4294967173&quot;\n"
full_name: Kernel#sprintf
is_singleton: false
name: sprintf
params: |
  format(format_string [, arguments...] )   => string
  sprintf(format_string [, arguments...] )  => string

visibility: public

Directory Contents

Dirs: 0 × Files: 74

Name Size Perms Modified Actions
656 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
394 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
542 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
788 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
529 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
527 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
678 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
739 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
710 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
968 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.03 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
4.43 KB lrw-r--r-- 2023-07-26 13:47:23
Edit Download
576 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
660 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
562 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
642 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
884 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.22 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
420 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.35 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.07 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
550 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
1.04 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
6.11 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
207 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.26 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
450 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
572 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
572 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
786 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
733 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
392 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
709 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
458 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
498 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.05 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
935 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
256 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
625 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
311 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
285 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
263 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
937 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
515 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
388 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
299 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
309 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.07 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.00 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
346 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
368 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.15 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
347 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
170 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
327 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.72 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
810 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
335 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
6.11 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
736 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
498 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
335 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
378 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
905 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
743 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
2.83 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
563 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
984 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
1.36 KB lrw-r--r-- 2023-07-26 13:47:24
Edit Download
487 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
296 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download
350 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
545 B lrw-r--r-- 2023-07-26 13:47:24
Edit Download
607 B lrw-r--r-- 2023-07-26 13:47:23
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).