Length and Indexer : StringBuilder : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » StringBuilder »

 

Length and Indexer








    
 

using System;
using System.Text;

class MainClass
{
    public static string ReverseString(string str)
    {
       if (str == null || str.Length <= 1) 
       {
            return str;
       }

       StringBuilder revStr = new StringBuilder(str.Length);


       for (int count = str.Length - 1; count > -1; count--)
       {
           revStr.Append(str[count]);
       }

       return revStr.ToString();
   }
   public static void Main(){
       Console.WriteLine(ReverseString("Madam Im Adam"));
       Console.WriteLine(ReverseString("The quick brown fox jumped over the lazy dog."));
   }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» StringBuilder