summaryrefslogtreecommitdiff
path: root/doc/string/each_codepoint.rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/string/each_codepoint.rdoc')
-rw-r--r--doc/string/each_codepoint.rdoc18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/string/each_codepoint.rdoc b/doc/string/each_codepoint.rdoc
new file mode 100644
index 0000000000..88bfcbd1c0
--- /dev/null
+++ b/doc/string/each_codepoint.rdoc
@@ -0,0 +1,18 @@
+Calls the given block with each successive codepoint from +self+;
+each codepoint is the integer value for a character;
+returns +self+:
+
+ 'hello'.each_codepoint {|codepoint| print codepoint, ' ' }
+ print "\n"
+ 'тест'.each_codepoint {|codepoint| print codepoint, ' ' }
+ print "\n"
+ 'こんにちは'.each_codepoint {|codepoint| print codepoint, ' ' }
+ print "\n"
+
+Output:
+
+ 104 101 108 108 111
+ 1090 1077 1089 1090
+ 12371 12435 12395 12385 12399
+
+Returns an enumerator if no block is given.