summaryrefslogtreecommitdiff
path: root/doc/string/bytesize.rdoc
blob: cbb7f439fcb44882f641d15693d199c0e4e7a0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Returns the count of bytes in +self+.

Note that the byte count may be different from the character count (returned by #size):

  s = 'foo'
  s.bytesize # => 3
  s.size     # => 3
  s = 'Привет'
  s.bytesize # => 12
  s.size     # => 6
  s = 'こんにちは'
  s.bytesize # => 15
  s.size     # => 5

Related: see {Querying}[rdoc-ref:String@Querying].