title: iterating over each character of a String in ruby 1.8.6 (each_char)
body: <p>I am new to ruby and currently trying to operate on each character separately from a base String in ruby. I am using ruby 1.8.6 and would like to do something like:</p>
  
  <pre><code>"ABCDEFG".each_char do |i|
    puts i
  end
  </code></pre>
  
  <p>This produces a undefined method `each_char' error.</p>
  
  <p>I was expecting to see a vertical output of:</p>
  
  <pre><code>A
  B
  C
  D
  ..etc
  </code></pre>
  
  <p>Is the <code>each_char</code> method defined only for 1.9? I tried using the plain <code>each</code> method, but the block simply ouputs the entire string in one line. The only way I figure how to do this, which is rather inconvenient is to create an array of characters from the begining:</p>
  
  <pre><code>['A','B','C','D','...'].each do|i|
    puts i
  end
  </code></pre>
  
  <p>This outputs the desired:</p>
  
  <pre><code>A
  B
  C
  ..etc
  </code></pre>
  
  <p>Is there perhaps a way to achive this output using an unmodified string to begin with?</p>
  
  <p>I think the Java equivalent is:</p>
  
  <pre><code>for (int i = 0; i &lt; aString.length(); i++){
    char currentChar = aString.charAt(i);
    System.out.println(currentChar);
  }
  </code></pre>