8000 * string.c (rb_str_bytesize): Improve documentation. Patch by Oscar · ruby/ruby@9360721 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 9360721

Browse files
committed
* 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
1 parent 6b5a88a commit 9360721

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Fri Jul 6 05:38:44 2012 Eric Hodel <drbrain@segment7.net>
2+
3+
* string.c (rb_str_bytesize): Improve documentation. Patch by Oscar
4+
Del Ben from github issue #138.
5+
* string.c (rb_str_empty): ditto.
6+
* string.c (rb_str_times): ditto.
7+
* string.c (rb_str_dump): ditto.
8+
* string.c (rb_str_center): ditto.
9+
110
Fri Jul 6 04:05:59 2012 Eric Hodel <drbrain@segment7.net>
211

312
* ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Use

string.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,10 @@ rb_str_length(VALUE str)
11471147
* call-seq:
11481148
* str.bytesize -> integer
11491149
*
1150-
* Returns the length of <i>str</i> in bytes.
1150+
* Returns the length of +str+ in bytes.
1151+
*
1152+
* "\x80\u3042".bytesize #=> 4
1153+
* "hello".bytesize #=> 5
11511154
*/
11521155

11531156
static VALUE
@@ -1163,6 +1166,7 @@ rb_str_bytesize(VALUE str)
11631166
* Returns <code>true</code> if <i>str</i> has a length of zero.
11641167
*
11651168
* "hello".empty? #=> false
1169+
* " ".empty? #=> false
11661170
* "".empty? #=> true
11671171
*/
11681172

@@ -1209,10 +1213,11 @@ rb_str_plus(VALUE str1, VALUE str2)
12091213
* call-seq:
12101214
* str * integer -> new_str
12111215
*
1212-
* Copy---Returns a new <code>String</code> containing <i>integer</i> copies of
1213-
* the receiver.
1216+
* Copy --- Returns a new String containing +integer+ copies of the receiver.
1217+
* +integer+ must be greater than or equal to 0.
12141218
*
12151219
* "Ho! " * 3 #=> "Ho! Ho! Ho! "
1220+
* "Ho! " * 0 #=> ""
12161221
*/
12171222

12181223
VALUE
@@ -4532,8 +4537,10 @@ rb_str_inspect(VALUE str)
45324537
* call-seq:
45334538
* str.dump -> new_str
45344539
*
4535-
* Produces a version of <i>str</i> with all nonprinting characters replaced by
4540+
* Produces a version of +str+ with all non-printing characters replaced by
45364541
* <code>\nnn</code> notation and all special characters escaped.
4542+
*
4543+
* "hello \n ''".dump #=> "\"hello \\n ''\"
45374544
*/
45384545

453945 8000 46
VALUE
@@ -7126,11 +7133,11 @@ rb_str_rjust(int argc, VALUE *argv, VALUE str)
71267133

71277134
/*
71287135
* call-seq:
7129-
* str.center(integer, padstr) -> new_str
7136+
* str.center(width, padstr=' ') -> new_str
71307137
*
7131-
* If <i>integer</i> is greater than the length of <i>str</i>, returns a new
7132-
* <code>String</code> of length <i>integer</i> with <i>str</i> centered and
7133-
* padded with <i>padstr</i>; otherwise, returns <i>str</i>.
7138+
* Centers +str+ in +width+. If +width+ is greater than the length of +str+,
7139+
* returns a new String of length +width+ with +str+ centered and padded with
7140+
* +padstr+; otherwise, returns +str+.
71347141
*
71357142
* "hello".center(4) #=> "hello"
71367143
* "hello".center(20) #=> " hello "

0 commit comments

Comments
 (0)
0