Monday, December 10, 2012

C# Tip : Reversing the order of words in a sentence

One of the frequent question in Technical Interviews. Its quite simple to Reverse the order of words in a sentence. 

Here is the Bit


        public static string ReverseWords(string SourceString)
        {
            string[] words = SourceString.Split(' ');
            Array.Reverse(words);
            return string.Join(" ", words);
        }

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments : on " C# Tip : Reversing the order of words in a sentence "