···
-----Original Message-----
From: ibraheem@ignoramus [mailto:ibraheem@ignoramus]On Behalf Of
Ibraheem Ibz Umaru-Mohammed
Sent: Saturday, October 19, 2002 1:03 PM
To: ruby-talk ML
Subject: Re: string[lastchar] → string?
Ahhh, yes! Thanks!
I was reading the Pragmatic… book and the String class
doesn’t have that ‘chr’ method there. (And a special thanks
for the negative indexes, which I missed completely…)
I usually just fire up the interpreter, and do something like:
class: String
A String object holds and manipulates an arbitrary sequence of
bytes, typically representing characters. String objects may be
created using String::new or as literals (see page 204).
Because of aliasing issues, users of strings should be aware of the
methods that modify the contents of a String object. Typically,
methods with names ending in ``!'' modify their receiver, while
those without a ``!'' return a new String. However, there are
exceptions, such as String#[]=.
%, *, +, <<, <=>, ==, ===, =~, [], []=, capitalize, capitalize!,
center, chomp, chomp!, chop, chop!, concat, count, crypt, delete,
delete!, downcase, downcase!, dump, each, each_byte, each_line,
empty?, gsub, gsub!, hash, hex, include?, index, intern, length,
ljust, new, next, next!, oct, replace, reverse, reverse!, rindex,
rjust, scan, size, slice, slice!, split, squeeze, squeeze!, strip,
strip!, sub, sub!, succ, succ!, sum, swapcase, swapcase!, to_f,
to_i, to_s, to_str, tr, tr!, tr_s, tr_s!, unpack, upcase, upcase!,
upto, ~
BTW, chr is not part of String, but belongs to Integers
$ ri chr
------------------------------------------------------------ Integer#chr
int.chr → aString
Returns a string containing the ASCII character represented by the
receiver's value.
65.chr #=> "A"
?a.chr #=> "a"
230.chr #=> "\346"
James