summaryrefslogtreecommitdiff
path: root/doc/string/bytesize.rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/string/bytesize.rdoc')
-rw-r--r--doc/string/bytesize.rdoc12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/string/bytesize.rdoc b/doc/string/bytesize.rdoc
new file mode 100644
index 0000000000..8d12a0d454
--- /dev/null
+++ b/doc/string/bytesize.rdoc
@@ -0,0 +1,12 @@
+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 # => 15
+ s.size # => 5
+
+Related: see {Querying}[rdoc-ref:String@Querying].