[DOC] Enhanced RDoc for String (#5724)

Treats:

    #scan
    #hex
    #oct
    #crypt
    #ord
    #sum
This commit is contained in:
Burdette Lamar 2022-03-27 14:45:14 -05:00 committed by GitHub
parent ca85f16a7d
commit d52cf1013f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2022-03-28 04:45:44 +09:00
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
3 changed files with 74 additions and 46 deletions

6
doc/string/ord.rdoc Normal file
View file

@ -0,0 +1,6 @@
Returns the integer ordinal of the first character of +self+:
'h'.ord # => 104
'hello'.ord # => 104
'тест'.ord # => 1090
'こんにちは'.ord # => 12371

11
doc/string/sum.rdoc Normal file
View file

@ -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.