mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_times): mentioned about Hash argument. a patch
from Daniel Bovensiepen at [ruby-core:32386]. * sprintf.c (get_hash): ditto, and fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f84f164413
commit
757f5bcb97
3 changed files with 14 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Wed Sep 15 07:27:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_times): mentioned about Hash argument. a patch
|
||||||
|
from Daniel Bovensiepen at [ruby-core:32386].
|
||||||
|
|
||||||
|
* sprintf.c (get_hash): ditto, and fix typo.
|
||||||
|
|
||||||
Wed Sep 15 07:22:20 2010 Tanaka Akira <akr@fsij.org>
|
Wed Sep 15 07:22:20 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/pathname/pathname.c (path_entries): Pathname#entries translated
|
* ext/pathname/pathname.c (path_entries): Pathname#entries translated
|
||||||
|
|
|
@ -422,13 +422,13 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv)
|
||||||
* sprintf("%u", -123) #=> "-123"
|
* sprintf("%u", -123) #=> "-123"
|
||||||
*
|
*
|
||||||
* For more complex formatting, Ruby supports a reference by name.
|
* For more complex formatting, Ruby supports a reference by name.
|
||||||
* %<name>s style uses format style, but ${name} style doesn't.
|
* %<name>s style uses format style, but %{name} style doesn't.
|
||||||
*
|
*
|
||||||
* Exapmles:
|
* Exapmles:
|
||||||
* sprintf("%<foo>d : %<bar>f" % { :foo => 1, :bar => 2 })
|
* sprintf("%<foo>d : %<bar>f" % { :foo => 1, :bar => 2 })
|
||||||
* #=> 1 : 2.000000
|
* #=> 1 : 2.000000
|
||||||
* sprintf("%d %{foo}" % { :foo => 'bar' })
|
* sprintf("%{foo}f" % { :foo => 1 })
|
||||||
* # => "%d bar"
|
* # => "1f"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
|
7
string.c
7
string.c
|
@ -1224,12 +1224,13 @@ rb_str_times(VALUE str, VALUE times)
|
||||||
*
|
*
|
||||||
* Format---Uses <i>str</i> as a format specification, and returns the result
|
* Format---Uses <i>str</i> as a format specification, and returns the result
|
||||||
* of applying it to <i>arg</i>. If the format specification contains more than
|
* of applying it to <i>arg</i>. If the format specification contains more than
|
||||||
* one substitution, then <i>arg</i> must be an <code>Array</code> containing
|
* one substitution, then <i>arg</i> must be an <code>Array</code> or <code>Hash</code>
|
||||||
* the values to be substituted. See <code>Kernel::sprintf</code> for details
|
* containing the values to be substituted. See <code>Kernel::sprintf</code> for
|
||||||
* of the format string.
|
* details of the format string.
|
||||||
*
|
*
|
||||||
* "%05d" % 123 #=> "00123"
|
* "%05d" % 123 #=> "00123"
|
||||||
* "%-5s: %08x" % [ "ID", self.object_id ] #=> "ID : 200e14d6"
|
* "%-5s: %08x" % [ "ID", self.object_id ] #=> "ID : 200e14d6"
|
||||||
|
* "foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue