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

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

Contrast with String#bytesize:

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

String#size is an alias for String#length.