%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Kernel/
Upload File :
Create Path :
Current File : //proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Kernel/sprintf-i.ri

U:RDoc::AnyMethod[iI"sprintf:ETI"Kernel#sprintf;TF:publico:RDoc::Markup::Document:@parts[&o:RDoc::Markup::Paragraph;	[I"HReturns the string resulting from applying <i>format_string</i> to ;FI"Iany additional arguments.  Within the format string, any characters ;FI":other than format sequences are copied to the result.;Fo:RDoc::Markup::BlankLineo;
;	[I"0The syntax of a format sequence is follows.;F@o:RDoc::Markup::Verbatim;	[I"%%[flags][width][.precision]type
;T:@format0o;
;	[I"A format ;FI"Fsequence consists of a percent sign, followed by optional flags, ;FI"Hwidth, and precision indicators, then terminated with a field type ;FI"?character.  The field type controls how the corresponding ;FI"I<code>sprintf</code> argument is to be interpreted, while the flags ;FI" modify that interpretation.;F@o;
;	[I"#The field type characters are:;F@o;;	[6I"Field |  Integer Format
;TI"K------+--------------------------------------------------------------
;TI"2  b   | Convert argument as a binary number.
;TI"F      | Negative numbers will be displayed as a two's complement
;TI""      | prefixed with `..1'.
;TI"D  B   | Equivalent to `b', but uses an uppercase 0B for prefix
;TI"-      | in the alternative format by #.
;TI"3  d   | Convert argument as a decimal number.
;TI"  i   | Identical to `d'.
;TI"2  o   | Convert argument as an octal number.
;TI"F      | Negative numbers will be displayed as a two's complement
;TI""      | prefixed with `..7'.
;TI"  u   | Identical to `d'.
;TI"7  x   | Convert argument as a hexadecimal number.
;TI"F      | Negative numbers will be displayed as a two's complement
;TI"E      | prefixed with `..f' (representing an infinite string of
;TI"      | leading 'ff's).
;TI"<  X   | Equivalent to `x', but uses uppercase letters.
;TI"
;TI"Field |  Float Format
;TI"K------+--------------------------------------------------------------
;TI"G  e   | Convert floating point argument into exponential notation
;TI"L      | with one digit before the decimal point as [-]d.dddddde[+-]dd.
;TI"L      | The precision specifies the number of digits after the decimal
;TI"(      | point (defaulting to six).
;TI"D  E   | Equivalent to `e', but uses an uppercase E to indicate
;TI"      | the exponent.
;TI"?  f   | Convert floating point argument as [-]ddd.dddddd,
;TI"F      | where the precision specifies the number of digits after
;TI"       | the decimal point.
;TI"D  g   | Convert a floating point number using exponential form
;TI"@      | if the exponent is less than -4 or greater than or
;TI"C      | equal to the precision, or in dd.dddd form otherwise.
;TI"G      | The precision specifies the number of significant digits.
;TI"K  G   | Equivalent to `g', but use an uppercase `E' in exponent form.
;TI"D  a   | Convert floating point argument as [-]0xh.hhhhp[+-]dd,
;TI"H      | which is consisted from optional sign, "0x", fraction part
;TI"C      | as hexadecimal, "p", and exponential part as decimal.
;TI"?  A   | Equivalent to `a', but use uppercase `X' and `P'.
;TI"
;TI"Field |  Other Format
;TI"K------+--------------------------------------------------------------
;TI"D  c   | Argument is the numeric code for a single character or
;TI"/      | a single character string itself.
;TI".  p   | The valuing of argument.inspect.
;TI"D  s   | Argument is a string to be substituted.  If the format
;TI"I      | sequence contains a precision, at most that many characters
;TI"      | will be copied.
;TI"J  %   | A percent sign itself will be displayed.  No argument taken.
;T;
0o;
;	[I"5The flags modifies the behavior of the formats. ;FI"The flag characters are:;F@o;;	[/I"(Flag     | Applies to    | Meaning
;TI"I---------+---------------+-----------------------------------------
;TI">space    | bBdiouxX      | Leave a space at the start of
;TI"6         | aAeEfgG       | non-negative numbers.
;TI"D         | (numeric fmt) | For `o', `x', `X', `b' and `B', use
;TI"E         |               | a minus sign with absolute value for
;TI"1         |               | negative values.
;TI"I---------+---------------+-----------------------------------------
;TI"G(digit)$ | all           | Specifies the absolute argument number
;TI"G         |               | for this field.  Absolute and relative
;TI"F         |               | argument numbers cannot be mixed in a
;TI"0         |               | sprintf string.
;TI"I---------+---------------+-----------------------------------------
;TI"; #       | bBoxX         | Use an alternative format.
;TI"P         | aAeEfgG       | For the conversions `o', increase the precision
;TI"E         |               | until the first digit will be `0' if
;TI"D         |               | it is not formatted as complements.
;TI"J         |               | For the conversions `x', `X', `b' and `B'
;TI"L         |               | on non-zero, prefix the result with ``0x'',
;TI"I         |               | ``0X'', ``0b'' and ``0B'', respectively.
;TI"K         |               | For `a', `A', `e', `E', `f', `g', and 'G',
;TI"C         |               | force a decimal point to be added,
;TI":         |               | even if no digits follow.
;TI"O         |               | For `g' and 'G', do not remove trailing zeros.
;TI"I---------+---------------+-----------------------------------------
;TI"H+        | bBdiouxX      | Add a leading plus sign to non-negative
;TI")         | aAeEfgG       | numbers.
;TI"D         | (numeric fmt) | For `o', `x', `X', `b' and `B', use
;TI"E         |               | a minus sign with absolute value for
;TI"1         |               | negative values.
;TI"I---------+---------------+-----------------------------------------
;TI"L-        | all           | Left-justify the result of this conversion.
;TI"I---------+---------------+-----------------------------------------
;TI"<0 (zero) | bBdiouxX      | Pad with zeros, not spaces.
;TI"H         | aAeEfgG       | For `o', `x', `X', `b' and `B', radix-1
;TI"J         | (numeric fmt) | is used for negative numbers formatted as
;TI"-         |               | complements.
;TI"I---------+---------------+-----------------------------------------
;TI"J*        | all           | Use the next argument as the field width.
;TI"M         |               | If negative, left-justify the result. If the
;TI"N         |               | asterisk is followed by a number and a dollar
;TI"O         |               | sign, use the indicated argument as the width.
;T;
0o;
;	[I"Examples of flags:;F@o;;	[:I"F# `+' and space flag specifies the sign of non-negative numbers.
;TI"#sprintf("%d", 123)  #=> "123"
;TI"$sprintf("%+d", 123) #=> "+123"
;TI"$sprintf("% d", 123) #=> " 123"
;TI"
;TI"@# `#' flag for `o' increases number of digits to show `0'.
;TI"># `+' and space flag changes format of negative numbers.
;TI"$sprintf("%o", 123)   #=> "173"
;TI"%sprintf("%#o", 123)  #=> "0173"
;TI"%sprintf("%+o", -123) #=> "-173"
;TI"'sprintf("%o", -123)  #=> "..7605"
;TI"'sprintf("%#o", -123) #=> "..7605"
;TI"
;TI"@# `#' flag for `x' add a prefix `0x' for non-zero numbers.
;TI"E# `+' and space flag disables complements for negative numbers.
;TI"#sprintf("%x", 123)   #=> "7b"
;TI"%sprintf("%#x", 123)  #=> "0x7b"
;TI"$sprintf("%+x", -123) #=> "-7b"
;TI"&sprintf("%x", -123)  #=> "..f85"
;TI"(sprintf("%#x", -123) #=> "0x..f85"
;TI""sprintf("%#x", 0)    #=> "0"
;TI"
;TI")# `#' for `X' uses the prefix `0X'.
;TI""sprintf("%X", 123)  #=> "7B"
;TI"$sprintf("%#X", 123) #=> "0X7B"
;TI"
;TI"@# `#' flag for `b' add a prefix `0b' for non-zero numbers.
;TI"E# `+' and space flag disables complements for negative numbers.
;TI"(sprintf("%b", 123)   #=> "1111011"
;TI"*sprintf("%#b", 123)  #=> "0b1111011"
;TI")sprintf("%+b", -123) #=> "-1111011"
;TI"+sprintf("%b", -123)  #=> "..10000101"
;TI"-sprintf("%#b", -123) #=> "0b..10000101"
;TI""sprintf("%#b", 0)    #=> "0"
;TI"
;TI")# `#' for `B' uses the prefix `0B'.
;TI"'sprintf("%B", 123)  #=> "1111011"
;TI")sprintf("%#B", 123) #=> "0B1111011"
;TI"
;TI"5# `#' for `e' forces to show the decimal point.
;TI"%sprintf("%.0e", 1)  #=> "1e+00"
;TI"&sprintf("%#.0e", 1) #=> "1.e+00"
;TI"
;TI"5# `#' for `f' forces to show the decimal point.
;TI"'sprintf("%.0f", 1234)  #=> "1234"
;TI"(sprintf("%#.0f", 1234) #=> "1234."
;TI"
;TI"5# `#' for `g' forces to show the decimal point.
;TI"0# It also disables stripping lowest zeros.
;TI"(sprintf("%g", 123.4)   #=> "123.4"
;TI"*sprintf("%#g", 123.4)  #=> "123.400"
;TI")sprintf("%g", 123456)  #=> "123456"
;TI"*sprintf("%#g", 123456) #=> "123456."
;T;
0o;
;	[I"FThe field width is an optional integer, followed optionally by a ;FI"Hperiod and a precision.  The width specifies the minimum number of ;FI"Bcharacters that will be written to the result for this field.;F@o;
;	[I"Examples of width:;F@o;;	[I"1# padding is done by spaces,       width=20
;TI"6# 0 or radix-1.             <------------------>
;TI"7sprintf("%20d", 123)   #=> "                 123"
;TI"7sprintf("%+20d", 123)  #=> "                +123"
;TI"7sprintf("%020d", 123)  #=> "00000000000000000123"
;TI"7sprintf("%+020d", 123) #=> "+0000000000000000123"
;TI"7sprintf("% 020d", 123) #=> " 0000000000000000123"
;TI"7sprintf("%-20d", 123)  #=> "123                 "
;TI"7sprintf("%-+20d", 123) #=> "+123                "
;TI"7sprintf("%- 20d", 123) #=> " 123                "
;TI"7sprintf("%020x", -123) #=> "..ffffffffffffffff85"
;T;
0o;
;	[I"	For ;FI"Inumeric fields, the precision controls the number of decimal places ;FI"Idisplayed.  For string fields, the precision determines the maximum ;FI"Knumber of characters to be copied from the string.  (Thus, the format ;FI"Fsequence <code>%10.10s</code> will always contribute exactly ten ;FI"characters to the result.);F@o;
;	[I"Examples of precisions:;F@o;;	[-I".# precision for `d', 'o', 'x' and 'b' is
;TI"7# minimum number of digits               <------>
;TI"8sprintf("%20.8d", 123)  #=> "            00000123"
;TI"8sprintf("%20.8o", 123)  #=> "            00000173"
;TI"8sprintf("%20.8x", 123)  #=> "            0000007b"
;TI"8sprintf("%20.8b", 123)  #=> "            01111011"
;TI"8sprintf("%20.8d", -123) #=> "           -00000123"
;TI"8sprintf("%20.8o", -123) #=> "            ..777605"
;TI"8sprintf("%20.8x", -123) #=> "            ..ffff85"
;TI"8sprintf("%20.8b", -11)  #=> "            ..110101"
;TI"
;TI":# "0x" and "0b" for `#x' and `#b' is not counted for
;TI"8# precision but "0" for `#o' is counted.  <------>
;TI"9sprintf("%#20.8d", 123)  #=> "            00000123"
;TI"9sprintf("%#20.8o", 123)  #=> "            00000173"
;TI"9sprintf("%#20.8x", 123)  #=> "          0x0000007b"
;TI"9sprintf("%#20.8b", 123)  #=> "          0b01111011"
;TI"9sprintf("%#20.8d", -123) #=> "           -00000123"
;TI"9sprintf("%#20.8o", -123) #=> "            ..777605"
;TI"9sprintf("%#20.8x", -123) #=> "          0x..ffff85"
;TI"9sprintf("%#20.8b", -11)  #=> "          0b..110101"
;TI"
;TI"&# precision for `e' is number of
;TI"9# digits after the decimal point           <------>
;TI">sprintf("%20.8e", 1234.56789) #=> "      1.23456789e+03"
;TI"
;TI"&# precision for `f' is number of
;TI"=# digits after the decimal point               <------>
;TI">sprintf("%20.8f", 1234.56789) #=> "       1234.56789000"
;TI"
;TI"&# precision for `g' is number of
;TI"=# significant digits                          <------->
;TI">sprintf("%20.8g", 1234.56789) #=> "           1234.5679"
;TI"
;TI"9#                                         <------->
;TI">sprintf("%20.8g", 123456789)  #=> "       1.2345679e+08"
;TI"
;TI"# precision for `s' is
;TI"@# maximum number of characters                    <------>
;TI"Asprintf("%20.8s", "string test") #=> "            string t"
;T;
0o;
;	[I"Examples:;F@o;;	[I"?sprintf("%d %04x", 123, 123)               #=> "123 007b"
;TI"Fsprintf("%08b '%4s'", 123, 123)            #=> "01111011 ' 123'"
;TI"Gsprintf("%1$*2$s %2$d %1$s", "hello", 8)   #=> "   hello 8 hello"
;TI"Bsprintf("%1$*2$s %2$d", "hello", -8)       #=> "hello    -8"
;TI"Gsprintf("%+g:% g:%-g", 1.23, 1.23, 1.23)   #=> "+1.23: 1.23:1.23"
;TI";sprintf("%u", -123)                        #=> "-123"
;T;
0o;
;	[I"EFor more complex formatting, Ruby supports a reference by name. ;FI"A%<name>s style uses format style, but %{name} style doesn't.;F@o;
;	[I"Examples:;Fo;;	[	I"<sprintf("%<foo>d : %<bar>f", { :foo => 1, :bar => 2 })
;TI"  #=> 1 : 2.000000
;TI"'sprintf("%{foo}f", { :foo => 1 })
;TI"  # => "1f";T;
0:
@fileI"
object.c;T:0@omit_headings_from_table_of_contents_below0I"8sprintf(format_string [, arguments...] )  -> string;F0[I"(*args);T@FI"Kernel;TcRDoc::NormalModule00

Zerion Mini Shell 1.0