@@ -1147,7 +1147,10 @@ rb_str_length(VALUE str)
1147
1147
* call-seq:
1148
1148
* str.bytesize -> integer
1149
1149
*
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
1151
1154
*/
1152
1155
1153
1156
static VALUE
@@ -1163,6 +1166,7 @@ rb_str_bytesize(VALUE str)
1163
1166
* Returns <code>true</code> if <i>str</i> has a length of zero.
1164
1167
*
1165
1168
* "hello".empty? #=> false
1169
+ * " ".empty? #=> false
1166
1170
* "".empty? #=> true
1167
1171
*/
1168
1172
@@ -1209,10 +1213,11 @@ rb_str_plus(VALUE str1, VALUE str2)
1209
1213
* call-seq:
1210
1214
* str * integer -> new_str
1211
1215
*
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 .
1214
1218
*
1215
1219
* "Ho! " * 3 #=> "Ho! Ho! Ho! "
1220
+ * "Ho! " * 0 #=> ""
1216
1221
*/
1217
1222
1218
1223
VALUE
@@ -4532,8 +4537,10 @@ rb_str_inspect(VALUE str)
4532
4537
* call-seq:
4533
4538
* str.dump -> new_str
4534
4539
*
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
4536
4541
* <code>\nnn</code> notation and all special characters escaped.
4542
+ *
4543
+ * "hello \n ''".dump #=> "\"hello \\n ''\"
4537
4544
*/
4538
4545
4539
45
8000
46
VALUE
@@ -7126,11 +7133,11 @@ rb_str_rjust(int argc, VALUE *argv, VALUE str)
7126
7133
7127
7134
/*
7128
7135
* call-seq:
7129
- * str.center(integer , padstr) -> new_str
7136
+ * str.center(width , padstr=' ' ) -> new_str
7130
7137
*
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+ .
7134
7141
*
7135
7142
* "hello".center(4) #=> "hello"
7136
7143
* "hello".center(20) #=> " hello "
0 commit comments