M
m4dc4p
I'm embarrassed to ask such a seeminly simple question, but I can't
figure out how to "easily" get the individual characters/bytes out of a
string as strings. For example:
"abc"[0]
# => 97
"abc"[0..0]
# => "a"
The first form gives me the character as a Fixnum, but I want a string.
The second form gives me what I want but it seems ugly. Is there a
better way to get at a given character, *as a string* ?
Thanks for any and all help!
Justin
figure out how to "easily" get the individual characters/bytes out of a
string as strings. For example:
"abc"[0]
# => 97
"abc"[0..0]
# => "a"
The first form gives me the character as a Fixnum, but I want a string.
The second form gives me what I want but it seems ugly. Is there a
better way to get at a given character, *as a string* ?
Thanks for any and all help!
Justin