summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBurdette Lamar <BurdetteLamar@Yahoo.com>2022-03-27 14:45:14 -0500
committerGitHub <noreply@github.com>2022-03-27 14:45:14 -0500
commitd52cf1013f974ed00502caac624e8094b777385d (patch)
treea9d29efe4c540166231026dec8bfae1556215b16 /doc
parentca85f16a7dc50145a61998c5caed2d49ef48b73c (diff)
[DOC] Enhanced RDoc for String (#5724)
Treats: #scan #hex #oct #crypt #ord #sum
Notes
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/string/ord.rdoc6
-rw-r--r--doc/string/sum.rdoc11
2 files changed, 17 insertions, 0 deletions
diff --git a/doc/string/ord.rdoc b/doc/string/ord.rdoc
new file mode 100644
index 0000000000..d586363d44
--- /dev/null
+++ b/doc/string/ord.rdoc
@@ -0,0 +1,6 @@
+Returns the integer ordinal of the first character of +self+:
+
+ 'h'.ord # => 104
+ 'hello'.ord # => 104
+ 'тест'.ord # => 1090
+ 'こんにちは'.ord # => 12371
diff --git a/doc/string/sum.rdoc b/doc/string/sum.rdoc
new file mode 100644
index 0000000000..5de24e6402
--- /dev/null
+++ b/doc/string/sum.rdoc
@@ -0,0 +1,11 @@
+Returns a basic +n+-bit checksum of the characters in +self+;
+the checksum is the sum of the binary value of each byte in +self+,
+modulo <tt>2**n - 1</tt>:
+
+ 'hello'.sum # => 532
+ 'hello'.sum(4) # => 4
+ 'hello'.sum(64) # => 532
+ 'тест'.sum # => 1405
+ 'こんにちは'.sum # => 2582
+
+This is not a particularly strong checksum.