summaryrefslogtreecommitdiff
path: root/doc/string/each_byte.rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/string/each_byte.rdoc')
-rw-r--r--doc/string/each_byte.rdoc17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/string/each_byte.rdoc b/doc/string/each_byte.rdoc
new file mode 100644
index 0000000000..643118fea3
--- /dev/null
+++ b/doc/string/each_byte.rdoc
@@ -0,0 +1,17 @@
+Calls the given block with each successive byte from +self+;
+returns +self+:
+
+ 'hello'.each_byte {|byte| print byte, ' ' }
+ print "\n"
+ 'тест'.each_byte {|byte| print byte, ' ' }
+ print "\n"
+ 'こんにちは'.each_byte {|byte| print byte, ' ' }
+ print "\n"
+
+Output:
+
+ 104 101 108 108 111
+ 209 130 208 181 209 129 209 130
+ 227 129 147 227 130 147 227 129 171 227 129 161 227 129 175
+
+Returns an enumerator if no block is given.