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

  'foo'.bytesize        # => 3
  'тест'.bytesize       # => 8
  'こんにちは'.bytesize   # => 15

Contrast with String#length:

  'foo'.length       # => 3
  'тест'.length      # => 4
  'こんにちは'.length  # => 5