Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOC] Enhanced RDoc for String (#5724)
Treats: #scan #hex #oct #crypt #ord #sum
- Loading branch information
1 parent
ca85f16
commit d52cf10
Showing
3 changed files
with
74 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Returns the integer ordinal of the first character of +self+: | ||
|
||
'h'.ord # => 104 | ||
'hello'.ord # => 104 | ||
'тест'.ord # => 1090 | ||
'こんにちは'.ord # => 12371 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters