From: Robert Klemme Date: 2011-01-18T16:50:38+09:00 Subject: Re: Weird error using String#[] On Thu, Jan 13, 2011 at 6:54 PM, Jason Mcdonald wrote: > That example shows the same behavior in my console as you show above. So > it is the \r that is causing it, it seems. I suppose the console sees > the \r and tries to create a new line, can't, and overwrites what is > there? No, \n is newline, \r is carriage return which simply positions the cursor at the beginning of the line. > The reason that it is one character too short is because the \r > would count as 1. To see what's really in the string you should use p or #inspect. > Thanks for the example! You're welcome! Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/