From: Holden Glova Date: 2001-01-02T16:16:46+09:00 Subject: [ruby-talk:8503] Re: Fetching a single character of a string -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Michael On Tue, 02 Jan 2001 19:55, I think Michael Granger wrote: > Because String[ Integer ] returns a Fixnum, I am currently extracting > single character strings from a string by doing: > > aString.split('')[ anInteger ] > > Is there a better way to get a single character of a string as a string > instead of a Fixnum? Or a way to convert a Fixnum to its character > string equivalent? I'm not sure if this is what you are looking for but if you try and put a range between the square brackets you will receive whatever is between the range as a String. For example: "String"[0..0] --> the String "S" "String"[0..1] --> the String "St" I hope this helps you out. - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE6UX/azrxa+Gy/b/4RAp7BAJwMNzEBOfl7uxuh8yNwOhIljHNuDQCdGV05 06eKqQIZ43QhAg95FHzraDE= =9VDT -----END PGP SIGNATURE-----