T
Tom Rathbone
Hi,
Is there a function that would work over the characters in String in
the way that each works for an array? I want to process the string
character by character and thought that #each would do this,
apparently not. Even better would be a collect style method.
Something like this.
"some string".collect do |x|
x + '|'
end
#collect_char or #each_char would be great.
Perhaps not the best example there, basically i intend to interpret a
string of character commands from a string i.e. something like
Brainf**k.
Thanks,
Tom.
Is there a function that would work over the characters in String in
the way that each works for an array? I want to process the string
character by character and thought that #each would do this,
apparently not. Even better would be a collect style method.
Something like this.
"some string".collect do |x|
x + '|'
end
#collect_char or #each_char would be great.
Perhaps not the best example there, basically i intend to interpret a
string of character commands from a string i.e. something like
Brainf**k.
Thanks,
Tom.