<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="http://blog.ernestohs.com/gadgets/Blog/templates/atom.xsl" ?><feed xmlns="http://www.w3.org/2005/Atom">
<link rel="self"  href="http://blog.ernestohs.com/index.php/Blog/Atom" title="Ernesto Herrera Salinas" />
<title  type="text" >Ernesto Herrera Salinas</title>
	<author>
		<name>Ernesto Herrera Salinas</name>
		<uri>http://blog.ernestohs.com</uri>
	</author>
<subtitle  type="text" >La Importancia de Llamarse Ernesto</subtitle>
<id>http://blog.ernestohs.com</id>
<generator>JAWS 0.8.9</generator>
<rights  type="text" >2009, Ernesto Herrera Salinas</rights>
<updated>2010-01-01T01:21:49-05:00</updated>
<entry>
	<title  type="text" ><![CDATA[ Quitter un cliente ligero y discreto de Twitter ]]></title>
	<link rel="alternate"  type="text/html"  href="http://blog.ernestohs.com/index.php/blog/show/Quitter-un-cliente-ligero-y-discreto-de-Twitter.html" title="Quitter un cliente ligero y discreto de Twitter" />
	<author>
		<name>Ernesto Herrera Salinas</name>
		<uri>http://blog.ernestohs.com/index.php/Blog/Atom</uri>
	</author>
	<id>http://blog.ernestohs.com/index.php/blog/show/Quitter-un-cliente-ligero-y-discreto-de-Twitter.html</id>
	<updated>2010-01-01T01:21:49-05:00</updated>
	<published>2010-01-01T00:57:51-05:00</published>
	<summary  type="html" ><![CDATA[ <p align="justify"><a href="http://quitter.codeplex.com">Quitter</a> es un cliente ligero de twitter, además es muy discreto para aquellos entornos en los cuales no te dejan tener el "Twitter" abierto en el navegador. Encontré este cliente de pura casualidad y sin estar buscándolo, cuando lo baje me dio algo de lata configurar lo pero luego de configurado funciona de maravilla.</p>
<h3>Lo malo</h3>
El programa no te deja escribir acentos o Ñ's peeeeeero tengo un parche de 3 centavos para el código fuente que agrega esta pequeña funcionalidad y claro que si aquí está el parche para que se lo apliquen al código y puedan ser felices y comer perdices.<br />
<center><br />
<h4>El parche</h4>
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-da0e21eab9e86ac2.skydrive.live.com/embedicon.aspx/.Public/spanishChars.patch"></iframe><br />
</center><br />
<h3>El Código Fuente</h3>
Este proyecto esta muy bien diseñado y prueba de esto es que copiando el Main del código todo esta claro como el agua:<br />
<div class="code"><div class="vb vb" style="font-family:monospace;">
<span style="color: #b1b100;">Sub</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; Initialize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">Dim</span> QuitSelected <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Boolean</span> = <span style="color: #b1b100;">False</span><br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">Do</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">If</span> _CurrentUser.<span style="color: #66cc66;">ScreenName</span> &lt;&gt; <span style="color: #b1b100;">String</span>.<span style="color: #66cc66;">Empty</span> <span style="color: #b1b100;">Then</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">String</span>.<span style="color: #b1b100;">Format</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;[{0} ({1})]&quot;</span>, _CurrentUser.<span style="color: #66cc66;">ScreenName</span>, _HitsRemaining<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Write</span><span style="color: #66cc66;">&#40;</span>MAIN_PROMPT<span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Dim</span> Choice <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span> = ReadKey<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;acdfhlpqrstu?x&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; Select <span style="color: #b1b100;">Case</span> Choice<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #b1b100;">String</span>.<span style="color: #66cc66;">Empty</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Write</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Read &quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Read<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;A&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;About Quitter&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; About<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;C&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Configuration&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ConfigureMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;D&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Write</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Direct messages &quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; DirectMessageMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;F&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Follow user&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; FollowUser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;L&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Open link&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; OpenLink<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;P&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Post&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; PostUpdate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;Q&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Quit&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">If</span> ReadYesNo<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Are you sure? (Y/N):&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">Then</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; QuitSelected = <span style="color: #b1b100;">True</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;R&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Reply&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Reply<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;S&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Search&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Search<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;T&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Re-tweet&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ReTweet<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;U&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Unfollow user&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; UnFollowUser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;?&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Help&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ShowHelp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">End</span> Select<br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">Loop</span> Until QuitSelected<br />
&#160; &#160; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span><br />
&#160;</div></div> ]]></summary>
	<content  type="html" ><![CDATA[ <p align="justify"><a href="http://quitter.codeplex.com">Quitter</a> es un cliente ligero de twitter, además es muy discreto para aquellos entornos en los cuales no te dejan tener el "Twitter" abierto en el navegador. Encontré este cliente de pura casualidad y sin estar buscándolo, cuando lo baje me dio algo de lata configurar lo pero luego de configurado funciona de maravilla.</p>
<h3>Lo malo</h3>
El programa no te deja escribir acentos o Ñ's peeeeeero tengo un parche de 3 centavos para el código fuente que agrega esta pequeña funcionalidad y claro que si aquí está el parche para que se lo apliquen al código y puedan ser felices y comer perdices.<br />
<center><br />
<h4>El parche</h4>
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-da0e21eab9e86ac2.skydrive.live.com/embedicon.aspx/.Public/spanishChars.patch"></iframe><br />
</center><br />
<h3>El Código Fuente</h3>
Este proyecto esta muy bien diseñado y prueba de esto es que copiando el Main del código todo esta claro como el agua:<br />
<div class="code"><div class="vb vb" style="font-family:monospace;">
<span style="color: #b1b100;">Sub</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; Initialize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">Dim</span> QuitSelected <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Boolean</span> = <span style="color: #b1b100;">False</span><br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">Do</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">If</span> _CurrentUser.<span style="color: #66cc66;">ScreenName</span> &lt;&gt; <span style="color: #b1b100;">String</span>.<span style="color: #66cc66;">Empty</span> <span style="color: #b1b100;">Then</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">String</span>.<span style="color: #b1b100;">Format</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;[{0} ({1})]&quot;</span>, _CurrentUser.<span style="color: #66cc66;">ScreenName</span>, _HitsRemaining<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Write</span><span style="color: #66cc66;">&#40;</span>MAIN_PROMPT<span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Dim</span> Choice <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span> = ReadKey<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;acdfhlpqrstu?x&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; Select <span style="color: #b1b100;">Case</span> Choice<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #b1b100;">String</span>.<span style="color: #66cc66;">Empty</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Write</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Read &quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Read<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;A&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;About Quitter&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; About<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;C&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Configuration&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ConfigureMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;D&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Write</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Direct messages &quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; DirectMessageMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;F&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Follow user&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; FollowUser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;L&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Open link&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; OpenLink<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;P&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Post&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; PostUpdate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;Q&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Quit&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">If</span> ReadYesNo<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Are you sure? (Y/N):&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">Then</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; QuitSelected = <span style="color: #b1b100;">True</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;R&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Reply&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Reply<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;S&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Search&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Search<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;T&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Re-tweet&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ReTweet<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;U&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Unfollow user&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; UnFollowUser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">Case</span> <span style="color: #ff0000;">&quot;?&quot;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WriteLine<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Help&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ShowHelp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">End</span> Select<br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">Loop</span> Until QuitSelected<br />
&#160; &#160; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span><br />
&#160;</div></div> ]]></content>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/7.html" term="7" label="Español"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/14.html" term="14" label="Visual Basic .NET"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/22.html" term="22" label="Twitter"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ Ordenamiento De Cadenas Por Longitud ]]></title>
	<link rel="alternate"  type="text/html"  href="http://blog.ernestohs.com/index.php/blog/show/Ordenamiento-De-Cadenas-Por-Longitud.html" title="Ordenamiento De Cadenas Por Longitud" />
	<author>
		<name>Ernesto Herrera Salinas</name>
		<uri>http://blog.ernestohs.com/index.php/Blog/Atom</uri>
	</author>
	<id>http://blog.ernestohs.com/index.php/blog/show/Ordenamiento-De-Cadenas-Por-Longitud.html</id>
	<updated>2009-08-10T00:43:02-05:00</updated>
	<published>2009-07-26T19:56:46-05:00</published>
	<summary  type="html" ><![CDATA[ <blockquote align="justify">Tienes una lista de cadenas y quieres ordenarlas según su longitud, de la más corta a la más larga. Esta misma solución se puede aplicar cambiando el criterio: alfabeticamente, mayor número de vocales, etc. Aquí expongo diferentes implementaciones de la misma estrategia en Java, C#, C++, PowerShell y C# con LinQ.</blockquote>
<h2>Introducción</h2>
<p align="justify">Como buen programador una de las cosas que más odio es hacer algo más de una vez, y lo que odio aún más es tener que explicar lo mismo más de una vez a una o varias personas, así que decidí publicar en mi Blog las respuestas a las preguntas más solicitadas por todos aquellos que me acosan en el correo electrónico, Messenger, celular, etc. (No se hagan ustedes saben quienes son).</p>
<p align="justify">El siguiente problema es un clásico, desde estudiantes de primer semestre hasta administradores de sistemas me han preguntado lo mismo (o alguna variante). Inclusive un estudiante me comento que tenia ya un mes intentando resolver este problema (de que los hay, los hay).</p>
<h2>Problema</h2>
<p align="justify">Tenemos una lista de cadenas y queremos ordenarlas de menor longitud a mayor longitud. Veamos pues un ejemplo:</p>
<table align="center" style="text-align: left; width: 238px;border:1px" border="1">
  <tbody>
    <tr align="center">
      <td style="width: 110px;background-color:black;color:white;">Entrada</td>
      <td style="width: 110px;background-color:black;color:white;">Salida</td>
    </tr>
    <tr>
      <td style="width: 110px;">Aerocrofobia</td>
      <td style="width: 110px;">No</td>
    </tr>
    <tr>
      <td style="width: 110px;">Haba</td>
      <td style="width: 110px;">Caf&eacute;</td>
    </tr>
    <tr>
      <td style="width: 110px;">No</td>
      <td style="width: 110px;">Haba</td>
    </tr>
    <tr>
      <td style="width: 110px;">Acluofobia</td>
      <td style="width: 110px;">Persa</td>
    </tr>
    <tr>
      <td style="width: 110px;">Bienvenido</td>
      <td style="width: 110px;">Litros</td>
    </tr>
    <tr>
      <td style="width: 110px;">Amaxofobia</td>
      <td style="width: 110px;">Palabra</td>
    </tr>
    <tr>
      <td style="width: 110px;">Palabra</td>
      <td style="width: 110px;">Iniciar</td>
    </tr>
    <tr>
      <td style="width: 110px;">Reflexolog&iacute;a</td>
      <td style="width: 110px;">Platano</td>
    </tr>
    <tr>
      <td style="width: 110px;">Atazagorafobia</td>
      <td style="width: 110px;">Gasolina</td>
    </tr>
    <tr>
      <td style="width: 110px;">Persa</td>
      <td style="width: 110px;">Aut&oacute;mata</td>
    </tr>
    <tr>
      <td style="width: 110px;">Aut&oacute;mata</td>
      <td style="width: 110px;">Amaxofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Iniciar</td>
      <td style="width: 110px;">Acluofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Allodoxafobia</td>
      <td style="width: 110px;">Bienvenido</td>
    </tr>
    <tr>
      <td style="width: 110px;">Litros</td>
      <td style="width: 110px;">Importante</td>
    </tr>
    <tr>
      <td style="width: 110px;">Apotenmofobia</td>
      <td style="width: 110px;">Aracnofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Gasolina</td>
      <td style="width: 110px;">Reflexolog&iacute;a</td>
    </tr>
    <tr>
      <td style="width: 110px;">Platano</td>
      <td style="width: 110px;">Aerocrofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Caf&eacute;</td>
      <td style="width: 110px;">Allodaxofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Importante</td>
      <td style="width: 110px;">Apotenmofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Aracnofobia</td>
      <td style="width: 110px;">Atazagorafobia</td>
    </tr>
  </tbody>
</table>
<h2>Solución</h2>
<p align="justify">A continuación expondré la misma solución en diferentes lenguajes, la solución siempre es la misma, solo se necesita establecer el criterio de ordenamiento en la función o método de ordenamiento.</p>
<h3>Versión Java™</h3>
<p align="justify">Este va primero por que nada arruina más mi día que tener que hablar de este P<span style="background-color:black;color:white;"><abr title="Odio este maldito lenguaje de porqueria">CENSURADO</abr></span>e lenguaje. Aquí pues el código:</p>
<p align="right">PorLongitud.java</p>
<div class="code"><div class="java java" style="font-family:monospace;">
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Comparator</span>;<br />
<span style="color: #000000; font-weight: bold;">class</span> PorLongitud <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Comparator</span> <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> compare<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o1, <span style="color: #003399;">Object</span> o2<span style="color: #009900;">&#41;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">String</span> a <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> o1; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">String</span> b <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> o2; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span> a.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> b.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">?-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> equals<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o<span style="color: #009900;">&#41;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span> <span style="color: #339933;">==</span> o; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span> <br />
&#160; &#160; &#160; &#160; <br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<p align="right">Programa.java</p>
<div class="code"><div class="java java" style="font-family:monospace;">
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.*</span>;<br />
<span style="color: #000000; font-weight: bold;">class</span> Programa <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">ArrayList</span> lista <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Aeroacrofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Haba&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;No&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Amaxofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bienvenido&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Palabra&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Reflexología&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Persa&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Autómata&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Iniciar&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Allodoxafobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Litros&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Gasolina&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Platano&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Café&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Importante&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Aracnofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o <span style="color: #339933;">:</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> o <span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">Collections</span>.<span style="color: #006633;">sort</span><span style="color: #009900;">&#40;</span>lista, <span style="color: #000000; font-weight: bold;">new</span> PorLongitud<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o <span style="color: #339933;">:</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> o <span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<h3>Versión C# <sub>(I love this language)</sub></h3>
<p align="justify">Saber <strong>delegar</strong> es la característica más importante de un buen <strike>líder</strike> programador:</p>
<div class="code"><div class="c c" style="font-family:monospace;">
class Program <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> Main<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> lista <span style="color: #339933;">=</span> new List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Aeroacrofobia&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Haba&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;No&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Amaxofobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Bienvenido&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Palabra&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Reflexología&quot;</span><span style="color: #339933;">,</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Persa&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Autómata&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Iniciar&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Allodoxafobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Litros&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Gasolina&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Platano&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Café&quot;</span><span style="color: #339933;">,</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Importante&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Aracnofobia&quot;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span>; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">Sort</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">string</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> a.<span style="color: #202020;">Length</span>.<span style="color: #202020;">CompareTo</span><span style="color: #009900;">&#40;</span>b.<span style="color: #202020;">Length</span><span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<p align="justify">Puedes descargar el código para Visual Studio 2008 <a href="http://cid-50f6b77bd41cf996.skydrive.live.com/self.aspx/Mini-Desarrollos/OrdenamientoPorLongitud/Ordenamiento%20Por%20Longitud%20CSharp.zip">aquí</a>:</p>
<iframe align="center" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:240px;height:66px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;" src="http://cid-50f6b77bd41cf996.skydrive.live.com/embedrowdetail.aspx/Mini-Desarrollos/OrdenamientoPorLongitud/Ordenamiento%20Por%20Longitud%20CSharp.zip"></iframe><br />
<p align="justify">Para aquellos interesados en LinQ al final de este bloque presento la solución usando solamente LinQ(Para que vean que bonito se programa en C#).</p>
<h3>Versión C++</h3>
<div class="code"><div class="c c" style="font-family:monospace;">
<span style="color: #339933;">#include &lt;iostream&gt;</span><br />
<span style="color: #339933;">#include &lt;list&gt;</span><br />
<span style="color: #339933;">#include &lt;string&gt;</span><br />
<span style="color: #339933;">#include &lt;algorithm&gt;</span><br />
using namespace std;<br />
bool PorLogitud<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">string</span> b<span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span> a.<span style="color: #202020;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> b.<span style="color: #202020;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>; <br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; list<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> ListaCadenas;<br />
&#160; &#160; &#160; &#160; list<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;::</span><span style="color: #202020;">iterator</span> it;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Aeroacrofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Haba&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;No&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Amaxofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Bienvenido&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Palabra&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Reflexología&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Persa&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Autómata&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Iniciar&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Allodoxafobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Litros&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Gasolina&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Platano&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Café&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Importante&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Aracnofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">sort</span><span style="color: #009900;">&#40;</span>PorLogitud<span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #000066;">cout</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #ff0000;">&quot;Mi Lista:&quot;</span> <span style="color: #339933;">&lt;&lt;</span> endl;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>it<span style="color: #339933;">=</span>ListaCadenas.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; it<span style="color: #339933;">!=</span>ListaCadenas.<span style="color: #202020;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #339933;">++</span>it<span style="color: #009900;">&#41;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000066;">cout</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #339933;">*</span>it <span style="color: #339933;">&lt;&lt;</span> endl; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color:#800080;">0</span>; <br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<h3>Versión PowerShell</h3>
<div class="terminal">
PS > Get-content -Path cadenas.txt | Sort-Object -Property Length
</div>
<h3>Versión C# Con LINQ (.NET 3.5)</h3>
<p align="justify">Haciendo uso de esta nueva característica este problema it’s a fuking peace of cake. Veamos el código:</p>
<div class="code"><div class="c c" style="font-family:monospace;">
public <span style="color: #993333;">static</span> List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> OrdenarPorLongitud<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; var ordenado <span style="color: #339933;">=</span> from cadena in lista orderby cadena.<span style="color: #202020;">Length</span> ascending select cadena; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> ordenado.<span style="color: #202020;">ToList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<p align="justify">¿La quieren aún más fácil?, pues ahí les va con expresiones Lamda:</p>
<div class="code"><div class="c c" style="font-family:monospace;">
class Program <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> Main<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> lista <span style="color: #339933;">=</span> new List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Aeroacrofobia&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Haba&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;No&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Amaxofobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Bienvenido&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Palabra&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Reflexología&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Persa&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Autómata&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Iniciar&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Allodoxafobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Litros&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Gasolina&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Platano&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Café&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Importante&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Aracnofobia&quot;</span> <span style="color: #009900;">&#125;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">Sort</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span>b<span style="color: #009900;">&#41;</span> <span style="color: #339933;">=&gt;</span> a.<span style="color: #202020;">Length</span>.<span style="color: #202020;">CompareTo</span><span style="color: #009900;">&#40;</span>b.<span style="color: #202020;">Length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<h3>Conclusión</h3>
<p align="justify">No hay razón para reinventar la rueda, el programador más listo es aquel que se duerme más temprano.</p> ]]></summary>
	<content  type="html" ><![CDATA[ <blockquote align="justify">Tienes una lista de cadenas y quieres ordenarlas según su longitud, de la más corta a la más larga. Esta misma solución se puede aplicar cambiando el criterio: alfabeticamente, mayor número de vocales, etc. Aquí expongo diferentes implementaciones de la misma estrategia en Java, C#, C++, PowerShell y C# con LinQ.</blockquote>
<h2>Introducción</h2>
<p align="justify">Como buen programador una de las cosas que más odio es hacer algo más de una vez, y lo que odio aún más es tener que explicar lo mismo más de una vez a una o varias personas, así que decidí publicar en mi Blog las respuestas a las preguntas más solicitadas por todos aquellos que me acosan en el correo electrónico, Messenger, celular, etc. (No se hagan ustedes saben quienes son).</p>
<p align="justify">El siguiente problema es un clásico, desde estudiantes de primer semestre hasta administradores de sistemas me han preguntado lo mismo (o alguna variante). Inclusive un estudiante me comento que tenia ya un mes intentando resolver este problema (de que los hay, los hay).</p>
<h2>Problema</h2>
<p align="justify">Tenemos una lista de cadenas y queremos ordenarlas de menor longitud a mayor longitud. Veamos pues un ejemplo:</p>
<table align="center" style="text-align: left; width: 238px;border:1px" border="1">
  <tbody>
    <tr align="center">
      <td style="width: 110px;background-color:black;color:white;">Entrada</td>
      <td style="width: 110px;background-color:black;color:white;">Salida</td>
    </tr>
    <tr>
      <td style="width: 110px;">Aerocrofobia</td>
      <td style="width: 110px;">No</td>
    </tr>
    <tr>
      <td style="width: 110px;">Haba</td>
      <td style="width: 110px;">Caf&eacute;</td>
    </tr>
    <tr>
      <td style="width: 110px;">No</td>
      <td style="width: 110px;">Haba</td>
    </tr>
    <tr>
      <td style="width: 110px;">Acluofobia</td>
      <td style="width: 110px;">Persa</td>
    </tr>
    <tr>
      <td style="width: 110px;">Bienvenido</td>
      <td style="width: 110px;">Litros</td>
    </tr>
    <tr>
      <td style="width: 110px;">Amaxofobia</td>
      <td style="width: 110px;">Palabra</td>
    </tr>
    <tr>
      <td style="width: 110px;">Palabra</td>
      <td style="width: 110px;">Iniciar</td>
    </tr>
    <tr>
      <td style="width: 110px;">Reflexolog&iacute;a</td>
      <td style="width: 110px;">Platano</td>
    </tr>
    <tr>
      <td style="width: 110px;">Atazagorafobia</td>
      <td style="width: 110px;">Gasolina</td>
    </tr>
    <tr>
      <td style="width: 110px;">Persa</td>
      <td style="width: 110px;">Aut&oacute;mata</td>
    </tr>
    <tr>
      <td style="width: 110px;">Aut&oacute;mata</td>
      <td style="width: 110px;">Amaxofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Iniciar</td>
      <td style="width: 110px;">Acluofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Allodoxafobia</td>
      <td style="width: 110px;">Bienvenido</td>
    </tr>
    <tr>
      <td style="width: 110px;">Litros</td>
      <td style="width: 110px;">Importante</td>
    </tr>
    <tr>
      <td style="width: 110px;">Apotenmofobia</td>
      <td style="width: 110px;">Aracnofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Gasolina</td>
      <td style="width: 110px;">Reflexolog&iacute;a</td>
    </tr>
    <tr>
      <td style="width: 110px;">Platano</td>
      <td style="width: 110px;">Aerocrofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Caf&eacute;</td>
      <td style="width: 110px;">Allodaxofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Importante</td>
      <td style="width: 110px;">Apotenmofobia</td>
    </tr>
    <tr>
      <td style="width: 110px;">Aracnofobia</td>
      <td style="width: 110px;">Atazagorafobia</td>
    </tr>
  </tbody>
</table>
<h2>Solución</h2>
<p align="justify">A continuación expondré la misma solución en diferentes lenguajes, la solución siempre es la misma, solo se necesita establecer el criterio de ordenamiento en la función o método de ordenamiento.</p>
<h3>Versión Java™</h3>
<p align="justify">Este va primero por que nada arruina más mi día que tener que hablar de este P<span style="background-color:black;color:white;"><abr title="Odio este maldito lenguaje de porqueria">CENSURADO</abr></span>e lenguaje. Aquí pues el código:</p>
<p align="right">PorLongitud.java</p>
<div class="code"><div class="java java" style="font-family:monospace;">
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Comparator</span>;<br />
<span style="color: #000000; font-weight: bold;">class</span> PorLongitud <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Comparator</span> <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> compare<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o1, <span style="color: #003399;">Object</span> o2<span style="color: #009900;">&#41;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">String</span> a <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> o1; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">String</span> b <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> o2; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span> a.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> b.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">?-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> equals<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o<span style="color: #009900;">&#41;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span> <span style="color: #339933;">==</span> o; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span> <br />
&#160; &#160; &#160; &#160; <br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<p align="right">Programa.java</p>
<div class="code"><div class="java java" style="font-family:monospace;">
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.*</span>;<br />
<span style="color: #000000; font-weight: bold;">class</span> Programa <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">ArrayList</span> lista <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Aeroacrofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Haba&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;No&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Amaxofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bienvenido&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Palabra&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Reflexología&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Persa&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Autómata&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Iniciar&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Allodoxafobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Litros&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Gasolina&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Platano&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Café&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Importante&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Aracnofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o <span style="color: #339933;">:</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> o <span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">Collections</span>.<span style="color: #006633;">sort</span><span style="color: #009900;">&#40;</span>lista, <span style="color: #000000; font-weight: bold;">new</span> PorLongitud<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o <span style="color: #339933;">:</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> o <span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<h3>Versión C# <sub>(I love this language)</sub></h3>
<p align="justify">Saber <strong>delegar</strong> es la característica más importante de un buen <strike>líder</strike> programador:</p>
<div class="code"><div class="c c" style="font-family:monospace;">
class Program <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> Main<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> lista <span style="color: #339933;">=</span> new List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Aeroacrofobia&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Haba&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;No&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Amaxofobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Bienvenido&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Palabra&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Reflexología&quot;</span><span style="color: #339933;">,</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Persa&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Autómata&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Iniciar&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Allodoxafobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Litros&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Gasolina&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Platano&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Café&quot;</span><span style="color: #339933;">,</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Importante&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Aracnofobia&quot;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span>; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">Sort</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">string</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> a.<span style="color: #202020;">Length</span>.<span style="color: #202020;">CompareTo</span><span style="color: #009900;">&#40;</span>b.<span style="color: #202020;">Length</span><span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<p align="justify">Puedes descargar el código para Visual Studio 2008 <a href="http://cid-50f6b77bd41cf996.skydrive.live.com/self.aspx/Mini-Desarrollos/OrdenamientoPorLongitud/Ordenamiento%20Por%20Longitud%20CSharp.zip">aquí</a>:</p>
<iframe align="center" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:240px;height:66px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;" src="http://cid-50f6b77bd41cf996.skydrive.live.com/embedrowdetail.aspx/Mini-Desarrollos/OrdenamientoPorLongitud/Ordenamiento%20Por%20Longitud%20CSharp.zip"></iframe><br />
<p align="justify">Para aquellos interesados en LinQ al final de este bloque presento la solución usando solamente LinQ(Para que vean que bonito se programa en C#).</p>
<h3>Versión C++</h3>
<div class="code"><div class="c c" style="font-family:monospace;">
<span style="color: #339933;">#include &lt;iostream&gt;</span><br />
<span style="color: #339933;">#include &lt;list&gt;</span><br />
<span style="color: #339933;">#include &lt;string&gt;</span><br />
<span style="color: #339933;">#include &lt;algorithm&gt;</span><br />
using namespace std;<br />
bool PorLogitud<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">string</span> b<span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span> a.<span style="color: #202020;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> b.<span style="color: #202020;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>; <br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; list<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> ListaCadenas;<br />
&#160; &#160; &#160; &#160; list<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;::</span><span style="color: #202020;">iterator</span> it;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Aeroacrofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Haba&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;No&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Amaxofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Bienvenido&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Palabra&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Reflexología&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Persa&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Autómata&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Iniciar&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Allodoxafobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Litros&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Gasolina&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Platano&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Café&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Importante&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">push_back</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Aracnofobia&quot;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; ListaCadenas.<span style="color: #202020;">sort</span><span style="color: #009900;">&#40;</span>PorLogitud<span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #000066;">cout</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #ff0000;">&quot;Mi Lista:&quot;</span> <span style="color: #339933;">&lt;&lt;</span> endl;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>it<span style="color: #339933;">=</span>ListaCadenas.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; it<span style="color: #339933;">!=</span>ListaCadenas.<span style="color: #202020;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #339933;">++</span>it<span style="color: #009900;">&#41;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000066;">cout</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #339933;">*</span>it <span style="color: #339933;">&lt;&lt;</span> endl; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color:#800080;">0</span>; <br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<h3>Versión PowerShell</h3>
<div class="terminal">
PS > Get-content -Path cadenas.txt | Sort-Object -Property Length
</div>
<h3>Versión C# Con LINQ (.NET 3.5)</h3>
<p align="justify">Haciendo uso de esta nueva característica este problema it’s a fuking peace of cake. Veamos el código:</p>
<div class="code"><div class="c c" style="font-family:monospace;">
public <span style="color: #993333;">static</span> List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> OrdenarPorLongitud<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; var ordenado <span style="color: #339933;">=</span> from cadena in lista orderby cadena.<span style="color: #202020;">Length</span> ascending select cadena; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> ordenado.<span style="color: #202020;">ToList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<p align="justify">¿La quieren aún más fácil?, pues ahí les va con expresiones Lamda:</p>
<div class="code"><div class="c c" style="font-family:monospace;">
class Program <span style="color: #009900;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> Main<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> lista <span style="color: #339933;">=</span> new List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Aeroacrofobia&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Haba&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;No&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Amaxofobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Bienvenido&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Palabra&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Reflexología&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Persa&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Autómata&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Iniciar&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Allodoxafobia&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Litros&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Gasolina&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Platano&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Café&quot;</span><span style="color: #339933;">,</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #ff0000;">&quot;Importante&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Aracnofobia&quot;</span> <span style="color: #009900;">&#125;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">Sort</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span>b<span style="color: #009900;">&#41;</span> <span style="color: #339933;">=&gt;</span> a.<span style="color: #202020;">Length</span>.<span style="color: #202020;">CompareTo</span><span style="color: #009900;">&#40;</span>b.<span style="color: #202020;">Length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lista.<span style="color: #202020;">ForEach</span><span style="color: #009900;">&#40;</span>delegate<span style="color: #009900;">&#40;</span><span style="color: #993333;">string</span> item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> System.<span style="color: #202020;">Console</span>.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>; <br />
&#160; &#160; &#160; &#160; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&#160;</div></div>
<h3>Conclusión</h3>
<p align="justify">No hay razón para reinventar la rueda, el programador más listo es aquel que se duerme más temprano.</p> ]]></content>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/1.html" term="1" label="General"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/2.html" term="2" label="C#"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/3.html" term="3" label="Java"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/4.html" term="4" label="PowerShell"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/5.html" term="5" label="C++"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/6.html" term="6" label="LinQ"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/7.html" term="7" label="Español"/>
		<category scheme="http://blog.ernestohs.com/index.php/blog/category/11.html" term="11" label="Windows"/>
</entry>
</feed>