| DECODE_DIGIT |
= |
{}.tap { |map| # ASCII A..Z map to 0..25 # ASCII a..z map to 0..25 (0..25).each { |i| map[65 + i] = map[97 + i] = i } |
|
Returns the numeric value of a basic code point (for use in representing
integers) in the range 0 to base-1, or nil if cp is does not represent a
value.
|
| ENCODE_DIGIT |
= |
proc { |d, flag| (d + 22 + (d < 26 ? 75 : 0) - (flag ? (1 << 5) : 0)).chr |
|
Returns the basic code point whose value (when used for representing
integers) is d, which must be in the range 0 to BASE-1. The lowercase form
is used unless flag is true, in which case the uppercase form is used. The
behavior is undefined if flag is nonzero and digit d has no uppercase form.
|