s = "A\nB" # Three ASCII characters on two lines # This does not work for multibyte strings in 1.8 # It works (inefficiently) for multibyte strings in 1.9: 0.upto(s.length-1) {|n| print s[n,1], " "}