Skip to content

Commit db6f397

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
Tweaks for String#bytesize
1 parent b1ce569 commit db6f397

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

doc/string/bytesize.rdoc

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
Returns the count of bytes (not characters) in +self+:
1+
Returns the count of bytes in +self+.
22

3-
'foo'.bytesize # => 3
4-
'тест'.bytesize # => 8
5-
'こんにちは'.bytesize # => 15
3+
Note that the byte count may be different from the character count (returned by #size):
64

7-
Contrast with String#length:
5+
s = 'foo'
6+
s.bytesize # => 3
7+
s.size # => 3
8+
s = 'тест'
9+
s.bytesize # => 8
10+
s.size # => 4
11+
s = 'こんにちは'
12+
s.bytesize # => 15
13+
s.size # => 5
814

9-
'foo'.length # => 3
10-
'тест'.length # => 4
11-
'こんにちは'.length # => 5
15+
Related: see {Querying}[rdoc-ref:String@Querying].

0 commit comments

Comments
 (0)