<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Handling Ruby&#8217;s String.each_char Iterator</title>
	<atom:link href="http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/feed/" rel="self" type="application/rss+xml" />
	<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/</link>
	<description>Juan A. Vazquez</description>
	<lastBuildDate>Wed, 12 Jan 2011 14:20:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: John P</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-651</link>
		<dc:creator>John P</dc:creator>
		<pubDate>Mon, 02 Aug 2010 21:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-651</guid>
		<description>I needed this to do a simple cleanup of strings entered by the default io.readline call. If the user hit backspace, the \b would get added to the string along w/the characters they were trying to get rid of. Here&#039;s an inelegant solution:

    def clean(line)
      #silly little routine to parse backspaces in the input line...  
      retval = &quot;&quot;
      line.each_byte do &#124;ch&#124;        
        if ch == 8 #backspace
          retval.chop!
        else
          retval &lt;&lt; ch
        end  
      end    
      return retval        
    end</description>
		<content:encoded><![CDATA[<p>I needed this to do a simple cleanup of strings entered by the default io.readline call. If the user hit backspace, the \b would get added to the string along w/the characters they were trying to get rid of. Here&#8217;s an inelegant solution:</p>
<p>    def clean(line)<br />
      #silly little routine to parse backspaces in the input line&#8230;<br />
      retval = &#8220;&#8221;<br />
      line.each_byte do |ch|<br />
        if ch == 8 #backspace<br />
          retval.chop!<br />
        else<br />
          retval &lt;&lt; ch<br />
        end<br />
      end<br />
      return retval<br />
    end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Travis B</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-541</link>
		<dc:creator>Travis B</dc:creator>
		<pubDate>Fri, 04 Sep 2009 04:14:55 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-541</guid>
		<description>If you click on the source in the docs, you get:

# File lib/jcode.rb, line 209
  def each_char
    if block_given?
      scan(/./m) do &#124;x&#124;
        yield x
      end
    else
      scan(/./m)
    end
  end

so yeah, just do &quot;string&quot;.scan(/./m)</description>
		<content:encoded><![CDATA[<p>If you click on the source in the docs, you get:</p>
<p># File lib/jcode.rb, line 209<br />
  def each_char<br />
    if block_given?<br />
      scan(/./m) do |x|<br />
        yield x<br />
      end<br />
    else<br />
      scan(/./m)<br />
    end<br />
  end</p>
<p>so yeah, just do &#8220;string&#8221;.scan(/./m)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-539</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 15 Aug 2009 14:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-539</guid>
		<description>&lt;a href=&quot;#comment-529&quot; rel=&quot;nofollow&quot;&gt;@Nick&lt;/a&gt; Great comment, I don&#039;t work with a whole lot of multi-byte character encodings. In this case, Jcode would be the way to go for Ruby 1.8. I haven&#039;t played much with Ruby 1.9 but I am excited to play with the better supported encodings that are baked right in.</description>
		<content:encoded><![CDATA[<p><a href="#comment-529" rel="nofollow">@Nick</a> Great comment, I don&#8217;t work with a whole lot of multi-byte character encodings. In this case, Jcode would be the way to go for Ruby 1.8. I haven&#8217;t played much with Ruby 1.9 but I am excited to play with the better supported encodings that are baked right in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-529</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Mon, 01 Jun 2009 02:10:21 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-529</guid>
		<description>Another &quot;thanks&quot; on the pile!

Will, unfortunately each_byte can cause problems with multi-byte character encodings.</description>
		<content:encoded><![CDATA[<p>Another &#8220;thanks&#8221; on the pile!</p>
<p>Will, unfortunately each_byte can cause problems with multi-byte character encodings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-528</link>
		<dc:creator>Marco</dc:creator>
		<pubDate>Mon, 25 May 2009 22:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-528</guid>
		<description>Man thank you so much for this, you have no idea how your insight helped me ! 

Thanks from Brazil
Marco</description>
		<content:encoded><![CDATA[<p>Man thank you so much for this, you have no idea how your insight helped me ! </p>
<p>Thanks from Brazil<br />
Marco</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EndtheProhibition</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-522</link>
		<dc:creator>EndtheProhibition</dc:creator>
		<pubDate>Sat, 09 May 2009 11:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-522</guid>
		<description>Thanks man! That&#039;s what I was looking for. :)
&quot;string&quot;.each_byte { &#124;f&#124; puts f.chr  }</description>
		<content:encoded><![CDATA[<p>Thanks man! That&#8217;s what I was looking for. <img src='http://javazquez.com/juan/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
&#8220;string&#8221;.each_byte { |f| puts f.chr  }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brian</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-485</link>
		<dc:creator>brian</dc:creator>
		<pubDate>Wed, 25 Mar 2009 00:12:33 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-485</guid>
		<description>Thanks so much for posting about this error in Ruby 1.8.6. I found your posting on the front page of my Google search results [ruby string each_char]. You saved me a lot of time and frustration.</description>
		<content:encoded><![CDATA[<p>Thanks so much for posting about this error in Ruby 1.8.6. I found your posting on the front page of my Google search results [ruby string each_char]. You saved me a lot of time and frustration.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-467</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 16 Mar 2009 01:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-467</guid>
		<description>You are all welcome :D</description>
		<content:encoded><![CDATA[<p>You are all welcome <img src='http://javazquez.com/juan/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ruby_n00b</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-466</link>
		<dc:creator>ruby_n00b</dc:creator>
		<pubDate>Sun, 15 Mar 2009 21:53:56 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-466</guid>
		<description>As 100% of the commenters have commented so far: THANK YOU.  I am yet another person who was stuck going cross-eyed over this error.  I figure another comment on this post might help google to keep this page &quot;fresh&quot; and high in the google stats.  So thanks again!</description>
		<content:encoded><![CDATA[<p>As 100% of the commenters have commented so far: THANK YOU.  I am yet another person who was stuck going cross-eyed over this error.  I figure another comment on this post might help google to keep this page &#8220;fresh&#8221; and high in the google stats.  So thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://javazquez.com/juan/2008/06/25/handling-rubys-stringeach_char-iterator/comment-page-1/#comment-463</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Fri, 06 Feb 2009 22:30:36 +0000</pubDate>
		<guid isPermaLink="false">http://javazquez.com/juan/?p=7#comment-463</guid>
		<description>Thanks!</description>
		<content:encoded><![CDATA[<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

