On 2/5/07, David Flanagan <david / davidflanagan.com> wrote:

> Does anyone (Matz?) know why the (new in 1.9) String.ord method is
> restricted to one-character Strings?

Because it only makes sense on a string of (character) length one.

> Why can't I pass the index to ord itself?  "ABC".ord(0) => 65

Because that's complicating matters unnecessarily, and indexing
shouldn't be part of the interface to a method that turns a string
into its position in the encoding table of the string in question.
You wouldn't expect String#succ to take an index, or String#hex for
that matter, right?

  nikolai