Hacked By AnonymousFox

Current Path : /proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Kernel/
Upload File :
Current File : //proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Kernel/format-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#format
is_singleton: false
name: format
params: |
  format(format_string [, arguments...] )   => string
  sprintf(format_string [, arguments...] )  => string

visibility: public

Hacked By AnonymousFox1.0, Coded By AnonymousFox