<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Three Ways to Reverse a String in C#</title>
	<atom:link href="http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/</link>
	<description></description>
	<lastBuildDate>Mon, 20 May 2013 23:27:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Susanta</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-194650</link>
		<dc:creator>Susanta</dc:creator>
		<pubDate>Wed, 26 Sep 2012 08:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-194650</guid>
		<description><![CDATA[static void Main(string[] args)
        {
            Console.WriteLine(&quot;Enter a string :&quot;);
            string Name = Console.ReadLine();
            char[] character = Name.ToCharArray();
            Console.WriteLine(&quot;Entered String is: &quot; + Name);            
            Array.Reverse(character);
            Console.WriteLine(&quot;After reverse string is :&quot;);
            Console.WriteLine(character);
            Console.ReadKey();
        }]]></description>
		<content:encoded><![CDATA[<p>static void Main(string[] args)<br />
        {<br />
            Console.WriteLine(&#8220;Enter a string :&#8221;);<br />
            string Name = Console.ReadLine();<br />
            char[] character = Name.ToCharArray();<br />
            Console.WriteLine(&#8220;Entered String is: &#8221; + Name);<br />
            Array.Reverse(character);<br />
            Console.WriteLine(&#8220;After reverse string is :&#8221;);<br />
            Console.WriteLine(character);<br />
            Console.ReadKey();<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nepaliguy</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-123998</link>
		<dc:creator>nepaliguy</dc:creator>
		<pubDate>Fri, 20 May 2011 11:41:17 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-123998</guid>
		<description><![CDATA[this works perfectly..kerry example gives index out of range error..may be its his typo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication5
{
    class Program
    {
        public static string ReverseString1(String str, int len)
        {
            if (len == 1)
                return str;
            else
                return ReverseString1(str.Substring(1, str.Length - 1), len-1)+str[0].ToString();

          }
        static void Main(string[] args)
        {
            string test = &quot;This is a test&quot;;
            int length = test.Length;
            string result=ReverseString1(test, length);
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}]]></description>
		<content:encoded><![CDATA[<p>this works perfectly..kerry example gives index out of range error..may be its his typo<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;</p>
<p>namespace ConsoleApplication5<br />
{<br />
    class Program<br />
    {<br />
        public static string ReverseString1(String str, int len)<br />
        {<br />
            if (len == 1)<br />
                return str;<br />
            else<br />
                return ReverseString1(str.Substring(1, str.Length &#8211; 1), len-1)+str[0].ToString();</p>
<p>          }<br />
        static void Main(string[] args)<br />
        {<br />
            string test = &#8220;This is a test&#8221;;<br />
            int length = test.Length;<br />
            string result=ReverseString1(test, length);<br />
            Console.WriteLine(result);<br />
            Console.ReadLine();<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coding test: write a function to reverse a string. &#171; spokeent</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-114227</link>
		<dc:creator>Coding test: write a function to reverse a string. &#171; spokeent</dc:creator>
		<pubDate>Wed, 13 Apr 2011 00:52:08 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-114227</guid>
		<description><![CDATA[[...] + reverse(left);      } else{  return str; }  } } http://www.dotnetperls.com/reverse-string http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/    GA_googleAddAttr(&quot;AdOpt&quot;, &quot;1&quot;); GA_googleAddAttr(&quot;Origin&quot;, &quot;other&quot;); [...]]]></description>
		<content:encoded><![CDATA[<p>[...] + reverse(left);      } else{  return str; }  } } <a href="http://www.dotnetperls.com/reverse-string" rel="nofollow">http://www.dotnetperls.com/reverse-string</a> <a href="http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/" rel="nofollow">http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/</a>    GA_googleAddAttr(&quot;AdOpt&quot;, &quot;1&quot;); GA_googleAddAttr(&quot;Origin&quot;, &quot;other&quot;); [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sampath</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-42655</link>
		<dc:creator>sampath</dc:creator>
		<pubDate>Tue, 15 Dec 2009 13:37:56 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-42655</guid>
		<description><![CDATA[protected void btnsubmit_Click(object sender, EventArgs e)
    {

        string str_in = txtinput.Text.Trim();
        string output = &quot;&quot;;
        for (int i = str_in.Length-1; i &gt;= 0; i--)
        {
            output = output + str_in.Substring(i,1);
        }
        txtoutput.Text = output;
        //another way
        char[] cstr = str_in.ToCharArray();
        Array.Reverse(cstr);
        txtoutput.Text = reversestring(cstr);

    }
    public string reversestring(char[] newq)
    {
        return new string(newq);
    }]]></description>
		<content:encoded><![CDATA[<p>protected void btnsubmit_Click(object sender, EventArgs e)<br />
    {</p>
<p>        string str_in = txtinput.Text.Trim();<br />
        string output = &#8220;&#8221;;<br />
        for (int i = str_in.Length-1; i &gt;= 0; i&#8211;)<br />
        {<br />
            output = output + str_in.Substring(i,1);<br />
        }<br />
        txtoutput.Text = output;<br />
        //another way<br />
        char[] cstr = str_in.ToCharArray();<br />
        Array.Reverse(cstr);<br />
        txtoutput.Text = reversestring(cstr);</p>
<p>    }<br />
    public string reversestring(char[] newq)<br />
    {<br />
        return new string(newq);<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry Starchuk</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-41567</link>
		<dc:creator>Dmitry Starchuk</dc:creator>
		<pubDate>Tue, 24 Nov 2009 01:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-41567</guid>
		<description><![CDATA[Here is another version, it has many variations 

/************************************************/
public string Reverse(string s, int l)
{
if (l == 1)
return s;
else
return s[l-1].ToString()+ Reverse(0,l-1), l – 1) + 
}
/************************************************/]]></description>
		<content:encoded><![CDATA[<p>Here is another version, it has many variations </p>
<p>/************************************************/<br />
public string Reverse(string s, int l)<br />
{<br />
if (l == 1)<br />
return s;<br />
else<br />
return s[l-1].ToString()+ Reverse(0,l-1), l – 1) +<br />
}<br />
/************************************************/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r deken</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-37528</link>
		<dc:creator>r deken</dc:creator>
		<pubDate>Tue, 08 Sep 2009 21:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-37528</guid>
		<description><![CDATA[following code also works for the recursive method:

/************************************************/
        public string Reverse(string s, int l)
        {
            if (l == 1)
                return s;
            else
                return Reverse(s.Substring(l - (s.Length - 1), s.Length - 1), l - 1) + s[0].ToString();
        }
/************************************************/
usage is the same as above]]></description>
		<content:encoded><![CDATA[<p>following code also works for the recursive method:</p>
<p>/************************************************/<br />
        public string Reverse(string s, int l)<br />
        {<br />
            if (l == 1)<br />
                return s;<br />
            else<br />
                return Reverse(s.Substring(l &#8211; (s.Length &#8211; 1), s.Length &#8211; 1), l &#8211; 1) + s[0].ToString();<br />
        }<br />
/************************************************/<br />
usage is the same as above</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chong yeow</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-33475</link>
		<dc:creator>chong yeow</dc:creator>
		<pubDate>Fri, 12 Jun 2009 07:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-33475</guid>
		<description><![CDATA[private string recursive(string s, int i)
		{
			if (i == 0)
			{
				return s.Substring(s.Length/2,s.Length/2);
			}
			else
			{
				return recursive(s + s.Substring(i-1,1), i-1);
			}
		}]]></description>
		<content:encoded><![CDATA[<p>private string recursive(string s, int i)<br />
		{<br />
			if (i == 0)<br />
			{<br />
				return s.Substring(s.Length/2,s.Length/2);<br />
			}<br />
			else<br />
			{<br />
				return recursive(s + s.Substring(i-1,1), i-1);<br />
			}<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavan kumar</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-32100</link>
		<dc:creator>Pavan kumar</dc:creator>
		<pubDate>Tue, 19 May 2009 10:52:24 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-32100</guid>
		<description><![CDATA[Hi Kerry D,

 I tried all the methods but third one is not working. But it looks good. could you please recode it.

Pavan]]></description>
		<content:encoded><![CDATA[<p>Hi Kerry D,</p>
<p> I tried all the methods but third one is not working. But it looks good. could you please recode it.</p>
<p>Pavan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 24234234</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-27162</link>
		<dc:creator>24234234</dc:creator>
		<pubDate>Sun, 22 Feb 2009 17:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-27162</guid>
		<description><![CDATA[char[] arr = s.ToCharArray();
        Array.Reverse(arr);
        return new string(arr);]]></description>
		<content:encoded><![CDATA[<p>char[] arr = s.ToCharArray();<br />
        Array.Reverse(arr);<br />
        return new string(arr);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lav</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-16133</link>
		<dc:creator>lav</dc:creator>
		<pubDate>Mon, 08 Sep 2008 05:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-16133</guid>
		<description><![CDATA[this code for recursion works
using system;
{
class reversedemo
{
string output=string.empty;
public void reverse(string s)
{
if(input.length&gt;0)
{
output+=s.substring(s.length-1);
s=s.substring(0,s.length-1);
reverse(s);
}
}
console.writeline(output);
public static void main()
{
reversedemo rd=new reversedemo();
rd.reverse(&quot;abcd&quot;);
}
}]]></description>
		<content:encoded><![CDATA[<p>this code for recursion works<br />
using system;<br />
{<br />
class reversedemo<br />
{<br />
string output=string.empty;<br />
public void reverse(string s)<br />
{<br />
if(input.length&gt;0)<br />
{<br />
output+=s.substring(s.length-1);<br />
s=s.substring(0,s.length-1);<br />
reverse(s);<br />
}<br />
}<br />
console.writeline(output);<br />
public static void main()<br />
{<br />
reversedemo rd=new reversedemo();<br />
rd.reverse(&#8220;abcd&#8221;);<br />
}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drifter5781</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-15963</link>
		<dc:creator>drifter5781</dc:creator>
		<pubDate>Thu, 04 Sep 2008 21:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-15963</guid>
		<description><![CDATA[Hi Kerry,
I&#039;ve tried your 3rd approach of reversing a string. It doesn&#039;t seem correct when I copy/paste your provided code snippet.

Thanks in advance]]></description>
		<content:encoded><![CDATA[<p>Hi Kerry,<br />
I&#8217;ve tried your 3rd approach of reversing a string. It doesn&#8217;t seem correct when I copy/paste your provided code snippet.</p>
<p>Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sachin</title>
		<link>http://www.kerrywong.com/2006/03/04/three-ways-to-reverse-a-string-in-c/comment-page-1/#comment-3459</link>
		<dc:creator>Sachin</dc:creator>
		<pubDate>Sun, 24 Feb 2008 11:12:49 +0000</pubDate>
		<guid isPermaLink="false">http://dimension/2006/03/04/three-ways-to-reverse-a-string-in-c/#comment-3459</guid>
		<description><![CDATA[Hello. I need to reverse a string using stack. I read this and truely i cant understand because i m a beginner .. I know push and pop codes. Will you please elaborate reverse function.]]></description>
		<content:encoded><![CDATA[<p>Hello. I need to reverse a string using stack. I read this and truely i cant understand because i m a beginner .. I know push and pop codes. Will you please elaborate reverse function.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
