each_char() public

Passes each character in str to the given block, or returns an enumerator if no block is given.

"hello".each_char {|c| print c, ' ' }


h e l l o
Show source
Register or log in to add new notes.
May 4, 2009 - (v1_8_6_287)
2 thanks

NoMethodError: undefined method `each_char'

For some reason the each_char method on String is not available by default in Ruby 1.8.6 and you will be presented with a NoMethodError.

You can resolve this by requiring the jcode lib:

require 'jcode'