diff options
Diffstat (limited to 'doc/string')
-rw-r--r-- | doc/string/bytesize.rdoc | 11 | ||||
-rw-r--r-- | doc/string/length.rdoc | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/doc/string/bytesize.rdoc b/doc/string/bytesize.rdoc new file mode 100644 index 0000000000..b0567ff67b --- /dev/null +++ b/doc/string/bytesize.rdoc @@ -0,0 +1,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 diff --git a/doc/string/length.rdoc b/doc/string/length.rdoc new file mode 100644 index 0000000000..0a7e17f7dc --- /dev/null +++ b/doc/string/length.rdoc @@ -0,0 +1,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. |