diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-05 20:39:15 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-05 20:39:15 +0000 |
commit | 9360721e5880fdeff4e72495991b3ffc8d94b190 (patch) | |
tree | 0fc6800d22bb1ab81670897dff5b66c0ec2beb53 | |
parent | 6b5a88a36dbd320466e4dcfb859a9ef4a6248e1d (diff) |
* string.c (rb_str_bytesize): Improve documentation. Patch by Oscar
Del Ben from github issue #138.
* string.c (rb_str_empty): ditto.
* string.c (rb_str_times): ditto.
* string.c (rb_str_dump): ditto.
* string.c (rb_str_center): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | string.c | 23 |
2 files changed, 24 insertions, 8 deletions
@@ -1,3 +1,12 @@ +Fri Jul 6 05:38:44 2012 Eric Hodel <drbrain@segment7.net> + + * string.c (rb_str_bytesize): Improve documentation. Patch by Oscar + Del Ben from github issue #138. + * string.c (rb_str_empty): ditto. + * string.c (rb_str_times): ditto. + * string.c (rb_str_dump): ditto. + * string.c (rb_str_center): ditto. + Fri Jul 6 04:05:59 2012 Eric Hodel <drbrain@segment7.net> * ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Use @@ -1147,7 +1147,10 @@ rb_str_length(VALUE str) * call-seq: * str.bytesize -> integer * - * Returns the length of <i>str</i> in bytes. + * Returns the length of +str+ in bytes. + * + * "\x80\u3042".bytesize #=> 4 + * "hello".bytesize #=> 5 */ static VALUE @@ -1163,6 +1166,7 @@ rb_str_bytesize(VALUE str) * Returns <code>true</code> if <i>str</i> has a length of zero. * * "hello".empty? #=> false + * " ".empty? #=> false * "".empty? #=> true */ @@ -1209,10 +1213,11 @@ rb_str_plus(VALUE str1, VALUE str2) * call-seq: * str * integer -> new_str * - * Copy---Returns a new <code>String</code> containing <i>integer</i> copies of - * the receiver. + * Copy --- Returns a new String containing +integer+ copies of the receiver. + * +integer+ must be greater than or equal to 0. * * "Ho! " * 3 #=> "Ho! Ho! Ho! " + * "Ho! " * 0 #=> "" */ VALUE @@ -4532,8 +4537,10 @@ rb_str_inspect(VALUE str) * call-seq: * str.dump -> new_str * - * Produces a version of <i>str</i> with all nonprinting characters replaced by + * Produces a version of +str+ with all non-printing characters replaced by * <code>\nnn</code> notation and all special characters escaped. + * + * "hello \n ''".dump #=> "\"hello \\n ''\" */ VALUE @@ -7126,11 +7133,11 @@ rb_str_rjust(int argc, VALUE *argv, VALUE str) /* * call-seq: - * str.center(integer, padstr) -> new_str + * str.center(width, padstr=' ') -> new_str * - * If <i>integer</i> is greater than the length of <i>str</i>, returns a new - * <code>String</code> of length <i>integer</i> with <i>str</i> centered and - * padded with <i>padstr</i>; otherwise, returns <i>str</i>. + * Centers +str+ in +width+. If +width+ is greater than the length of +str+, + * returns a new String of length +width+ with +str+ centered and padded with + * +padstr+; otherwise, returns +str+. * * "hello".center(4) #=> "hello" * "hello".center(20) #=> " hello " |